Skip to content
We're currently creating a lot of content. Sign up to get notified when it's ready.

Overview

The @qatium/plugin/ui library exports methods to work with the UI of the plugin.

sendMessage()

Allows the plugin UI to communicate with its engine. Learn more about plugin communication.

Method signature

sendMessage<T>(message: T): void
Parameters
  • message: T: an arbitrary message to be sent to the engine. Check the documentation of structuredClone to verify what can be sent.

Example

Send a message to the engine

sendMessage("my message")

onMessage()

Allows for listening messages from the plugin engine. Learn more about plugin communication.

Method signature

onMessage<T>(message: T): void
Parameters
  • message: T: The message sent by the plugin engine.

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}`;
});