Overview
Package: @qatium/sdk/ui
This package exports methods to work with the Panel of the plugin.
sendMessage()
Section titled “sendMessage()”Allows the plugin UI to communicate with the plugin logic. Learn more about plugin communication.
Method signature
Section titled “Method signature”sendMessage<T>(message: T): void
Parameters
Section titled “Parameters”message: T
: an arbitrary message to be sent to the logic of the plugin. Check the documentation of structuredClone to verify what can be sent.
Example
Section titled “Example”Send a message to the plugin logic
sendMessage("my message")
onMessage()
Section titled “onMessage()”Allows for listening messages from the plugin logic. Learn more about plugin communication.
Method signature
Section titled “Method signature”onMessage<T>(message: T): void
Parameters
Section titled “Parameters”message: T
: The message sent by the plugin logic.
Example
Section titled “Example”Receives a message and prints it into an HTML element.
onMessage<string>((message) => { const element = document.getElementById("response");
if (!element) { return; }
element.innerHTML = `Response: ${message}`;});