Skip to main content

api.events

Interface: IEventsApi

Implementation tier: T1

Subscribe to host-emitted extension point events (verse rendering, content module hooks, search hooks, workspace lifecycle, etc.).

info

Wraps the cross-cutting subscription model so extensions can subscribe to host-emitted hook events (the ~30 hooks listed in ExtensionPointTypes.ts).

The host wraps every emit with a try/catch and a 2-second timeout per subscriber; a slow or throwing subscriber gets its handle disposed with a logged warning, but never blocks the host or other subscribers.

Methods

subscribe

subscribe<T>(
channel: ExtensionPointId,
handler: (payload: T) => void | Promise<void>,
): Promise<DisposableHandle>

Parameters:

NameTypeRequiredDescription
channelExtensionPointIdYes
handler(payload: T) => void | Promise<void>,Yes

Returns: Promise<DisposableHandle>