KPluginUI
kds-plugin-document / Exports / KPluginUI
Interface: KPluginUI
代表展示插件 UI html 的窗口
The KPluginUI class now contains methods for operating plugin UIs. You can access the KPluginUI by calling the app.getPluginUI() method.
Table of contents
Properties
Methods
Properties
mounted
• Readonly
mounted: boolean
代表 UI 窗口是否已经被显示。true 为已显示
Return true if the plugin UI is mounted, else return false.
Defined in
api.d.ts:11181
Methods
mount
▸ mount(): void
显示插件 UI 窗口
Mount the plugin UI.
Returns
void
Defined in
api.d.ts:11190
onMessage
▸ onMessage(callback
): void
注册插件 UI 窗口发送的自定义消息的响应函数
Register the callback function for the plugin UI. When a message is sent from the plugin UI, the callback function will be called.
Parameters
Name | Type |
---|---|
callback | (data : any , origin : string ) => void |
Returns
void
Defined in
api.d.ts:11227
onReady
▸ onReady(callback
): void
注册插件 UI 窗口显示完成后的回调函数
Register the callback function. When the plugin UI is ready, the callback function will be called.
Parameters
Name | Type |
---|---|
callback | () => void |
Returns
void
Defined in
api.d.ts:11218
postMessage
▸ postMessage(data
, origin?
): void
从沙盒 JS 代码向插件 UI 窗口发送自定义消息
Post a message from the sandbox to the plugin UI.
Parameters
Name | Type | Description |
---|---|---|
data | any | The data posted from the sandbox. |
origin? | string | Specifies what the origin of this window must be for the event to be dispatched, either as the literal string "*" (indicating no preference) or as a URI. |
Returns
void
Defined in
api.d.ts:11238
resize
▸ resize(width
, height
): void
调整插件 UI 窗口大小
Resize the plugin UI.
Parameters
Name | Type |
---|---|
width | number |
height | number |
Returns
void
Defined in
api.d.ts:11208
unmount
▸ unmount(): void
关闭插件 UI 窗口
UnMount the plugin UI.
Returns
void
Defined in
api.d.ts:11199