definePlugin
function definePlugin(plugin): Readonly<Plugin>;Declares a plugin. The bundle of a plugin ends with the value that this function returns.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
plugin |
Plugin |
an object with onload(ctx) and, if you want, onunload() |
Returns
Section titled “Returns”Readonly<Plugin>
the same object, frozen so that it cannot be changed
Throws
Section titled “Throws”TypeError - when onload is not a function, or when onunload is given and is not a function
Example
Section titled “Example”import { definePlugin, type PluginContext } from '@tessera/plugin-sdk';
export default definePlugin({ onload(ctx: PluginContext) { // register hooks, commands and so on here },});