Skip to main content

event

function

Declare an event your mod can publish. The payload type is read off `TPayload` by the authoring compiler, so the host validates every emit and every subscriber sees the shape it expects. Use this when your mod is the thing that happened. To listen to something the host already publishes, subscribe with `ctx.on('editor.selectionChanged', listener)` or, for a host event source, `system.on(...)`.

function event<TPayload>(input: EventInput<TPayload>): Event<TPayload>

Import

import { event } from '@modular/sdk';

Notes

category
State