Skip to main content

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:13173

Methods​

mount​

▸ mount(): void

显示插件 UI 窗口

Mount the plugin UI.

Returns​

void

Defined in​

api.d.ts:13182


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​

NameType
callback(data: any, origin: string) => void

Returns​

void

Defined in​

api.d.ts:13219


onReady​

▸ onReady(callback): void

注册插件 UI 窗口显示完成后的回调函数

Register the callback function. When the plugin UI is ready, the callback function will be called.

Parameters​

NameType
callback() => void

Returns​

void

Defined in​

api.d.ts:13210


postMessage​

▸ postMessage(data, origin?): void

从沙盒 JS 代码向插件 UI 窗口发送自定义消息

Post a message from the sandbox to the plugin UI.

Parameters​

NameTypeDescription
dataanyThe data posted from the sandbox.
origin?stringSpecifies 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:13230


resize​

▸ resize(width, height): void

调整插件 UI 窗口大小

Resize the plugin UI.

Parameters​

NameType
widthnumber
heightnumber

Returns​

void

Defined in​

api.d.ts:13200


unmount​

▸ unmount(): void

关闭插件 UI 窗口

UnMount the plugin UI.

Returns​

void

Defined in​

api.d.ts:13191