Skip to content

Plugin

What the bundle of a plugin exports: a function onload, and optionally onunload. Make it with definePlugin.

onload(ctx): void | Promise<void>;

The app calls this function once, when the plugin is turned on. Everything that the plugin registers through ctx is removed when the plugin is turned off.

Parameter Type Description
ctx PluginContext the object through which the plugin reaches the app

void | Promise<void>


onunload?(): void | Promise<void>;

The app calls this function when the plugin is turned off, just before it removes what the plugin registered through ctx. It is the place to clean up anything that the plugin created without using ctx.

void | Promise<void>