@pixso/plugin-typings
Version:
Typings for the Pixso Plugin API
23 lines (20 loc) • 831 B
TypeScript
declare type HostArgFreeEventType = 'mounted' | 'beforeunmount'
interface HostAPI {
on(type: HostArgFreeEventType, callback: () => void): void
once(type: HostArgFreeEventType, callback: () => void): void
off(type: HostArgFreeEventType, callback: () => void): void
showPluginDockAsync(): Promise<void>
sandbox: SandboxAPI
}
interface SandboxAPI {
/**
* Starts the Sandbox with the provided JavaScript code.
* This method is available only to global plugins.
*/
run?: (sandboxJS: string) => Promise<boolean>
postMessage: (message: unknown) => void
onmessage: (message: any) => void | undefined
on: (event: 'message', cb: (message: any) => void) => void
once: (event: 'message', cb: (message: any) => void) => void
off: (event: 'message', cb: (message: any) => void) => void
}