Skip to content

definePlugin

function definePlugin(plugin): Readonly<Plugin>;

Declares a plugin. The bundle of a plugin ends with the value that this function returns.

Parameter Type Description
plugin Plugin an object with onload(ctx) and, if you want, onunload()

Readonly<Plugin>

the same object, frozen so that it cannot be changed

TypeError - when onload is not a function, or when onunload is given and is not a function

import { definePlugin, type PluginContext } from '@tessera/plugin-sdk';
export default definePlugin({
onload(ctx: PluginContext) {
// register hooks, commands and so on here
},
});