pixso.ui
pixso.ui
object contains the interface for manipulating the user interface and communicating information with it.
bounds
- Readonly:
true
- Type:
Rect
interface Rect {
readonly x: number;
readonly y: number;
readonly width: number;
readonly height: number;
}
Boundary information of the current UI in the browser coordinate system.
mode
- Type:
"NORMAL" | "SIMPLIFIED"
The display mode of the current UI modal box, the default is NORMAL
, SIMPLIFIED
mode will hide the plug-in icon and title. Can be set in the options
parameter when calling pixso.showUI
.
visible
- Type:
boolean
Whether the current UI modal box is displayed.
show
- Type:
show(): void
Makes the plugin's UI visible. Use this to show the UI if it was created using pixso.showUI(..., { visible: false })
, or after a call to pixso.ui.hide()
.
hide
- Type:
hide(): void
Hides the current UI. The UI will still continue to run code and be able to send and receive messages. However, it is not rendered to the user.
resize
- Type:
resize(width: number, height: number): void
Changes the size of the UI, after it has been created.
close
- Type:
close(): void
Destroys the UI and its containing iframe. Once this has been called, the code inside the iframe will be stopped and you can no longer send messages to and from it.
postMessage
- Type:
postMessage(pluginMessage: any, options?: UIPostMessageOptions): void
Parameters
pluginMessage
This can be almost any data type or plain object, as long as it's a serializable object.
This is similar to saying that it should be possible to send the object over a network if it were necessary. You can send objects, arrays, numbers, strings, booleans, null, undefined, Date objects and Uint8Array objects. However, functions and prototype chains of objects will not be sent.
onMessage
- Type:
onmessage: MessageEventHandler | undefined;
type MessageEventHandler = (
pluginMessage: any,
props: OnMessageProperties
) => void;
Register the execution function for the message event of the UI modal box.
on
- Type:
on(type: "message", callback: MessageEventHandler): void;
on(type: "minimize", callback: () => void): void;
Register the execution function for the message event of the UI modal box.
once
- Type:
once(type: "message", callback: MessageEventHandler): void;
once(type: "minimize", callback: () => void): void;
Register the execution function of the message event of the UI modal box, but it will be executed only once.
off
- Type:
off(type: "message", callback: MessageEventHandler): void;
off(type: "minimize", callback: () => void): void;
Remove the event execution function registered by pixso.ui.on
or pixso.ui.once
.
enableMinimize
- Type:
boolean
Whether the current UI modal box displays the minimize button, the default is false
. Can be set in the options
parameter when calling pixso.showUI
.
minimizeTip
- Type:
string
The floating prompt text of the minimize button of the UI modal box.
setMinimizeIcon
- type:
setCloseIcon(icon: string | Uint8Array): void
Modify the icon of the UI modal minimize button.
closeTip
- Type:
string
The floating prompt text of the UI modal box close button.
setCloseIcon
- type:
setCloseIcon(icon: string | Uint8Array): void
Modify the icon of the UI modal box close button.