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"
- Tip:
Cross-thread Communication
The display mode of the current UI modal box, the default is NORMAL
, SIMPLIFIED
mode will hide the plugin icon and title. Can be set in the options
parameter when calling pixso.showUI
.
visible
- Type:
boolean
- Tip:
Cross-thread Communication
Whether the current UI modal box is displayed.
show
- Type:
show(): void
- Tip:
Cross-thread Communication
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
- Tip:
Cross-thread Communication
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
- Tip:
Cross-thread Communication
Changes the size of the UI, after it has been created.
close
- Type:
close(): void
- Tip:
Cross-thread Communication
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
- Tip:
Cross-thread Communication
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
- Tip:
Cross-thread Communication
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
- Tip:
Cross-thread Communication
The floating prompt text of the minimize button of the UI modal box.
setMinimizeIcon
- type:
setCloseIcon(icon: string | Uint8Array): void
- Tip:
Cross-thread Communication
Modify the icon of the UI modal minimize button.
HWDC
enableClose
- Tip:
Cross-thread Communication
Whether the current UI modal box displays a close button.
closeTip
- Type:
string
- Tip:
Cross-thread Communication
The floating prompt text of the UI modal box close button.
setCloseIcon
- type:
setCloseIcon(icon: string | Uint8Array): void
- Tip:
Cross-thread Communication
Modify the icon of the UI modal box close button.
enableResize
- Type:
boolean
- Tip:
Cross-thread Communication
Whether the current UI modal box can be resized.
minWidth
- Type:
number
- Tip:
Cross-thread Communication
The minimum width of the current UI modal box.
minHeight
- Type:
number
- Tip:
Cross-thread Communication
The minimum height of the current UI modal box.