pixso.host
pixso.host
对象提供了插件宿主相关属性的 API。
clientWidth
- Readonly:
true
- Type:
number
获取宿主可视窗口的宽度。
clientHeight
- Readonly:
true
- Type:
number
获取宿主可视窗口的高度。
platform
- Readonly:
true
- Type:
PlatformType
type PlatformType = "MAC" | "WINDOWS" | "UNKNOWN";
返回宿主所属的操作系统类型。
HWDC
postMessage
- type:
postMessage: (message: any) => void
由 sandbox.js
向 host.js
发送消息。
onmessage
- type:
Function | undefined
监听 host.js
向 sandbox.js
发送的消息。
on
- type:
on: (event: 'message', cb: (event: any) => void) => void
监听 host.js
向 sandbox.js
发送的消息。
once
- type:
once: (event: 'message', cb: (event: any) => void) => void
监听 host.js
向 sandbox.js
发送的消息,回调函数运行一次后便移除监听。
off
- type:
off: (event: 'message', cb: (event: any) => void) => void
移除通过 pixso.host.on
或 pixso.host.once
绑定的事件处理函数。