KApplicationObserver
kds-plugin-document / Exports / KApplicationObserver
Interface: KApplicationObserver
应用观察者用于响应酷大师发出的各种事件
目前酷大师只会发出一种事件,就是插件 UI 面板被关闭的事件。
插件可以实现此接口,并调用 KApplication.addPluginObserver 方法将观察者注册到酷大师,用于响应酷大师事件
This observer interface is implemented to react to plugin events. To create a new observer, you must define a new class that implements all the methods of the KPluginObserver class. Once you have defined a observer class, you can add it to the application object by the KApplication.addPluginObserver method. you also can remove it from the application object by the KSelection.removePluginObserver method.
Table of contents
Methods
Methods
onGroupInstanceActivated
▸ Optional
onGroupInstanceActivated(groupInstance
): void
当成组实例被激活时,酷大师会调用这个接口
The method is called when the group instance is activated.
Parameters
Name | Type |
---|---|
groupInstance | KGroupInstance |
Returns
void
Defined in
api.d.ts:518
onGroupInstanceDeactivated
▸ Optional
onGroupInstanceDeactivated(groupInstance
): void
当成组实例退出激活态时,酷大师会调用这个接口
The method is called when the group instance is deactivated.
Parameters
Name | Type |
---|---|
groupInstance | KGroupInstance |
Returns
void
Defined in
api.d.ts:526
onModelChanged
▸ Optional
onModelChanged(changes
): void
酷大师方案被修改时,会回调观察者的这个方法,告知被修改的成组。
This method will be called by system when the model is changed, let plugin know the changed group definitions.
Parameters
Name | Type |
---|---|
changes | Object |
changes.added? | KGroupDefinition [] |
changes.deleted? | KGroupDefinition [] |
changes.isUndoRedo | boolean |
changes.modified? | KGroupDefinition [] |
Returns
void
Defined in
api.d.ts:510
onPluginClosed
▸ onPluginClosed(): void
酷大师关闭插件 UI 面板时,会调用观察者的这个方法
The method is called whenever the plugin is closed.
Returns
void
Defined in
api.d.ts:503