Skip to content

subscribeEvent<Source, EventName>

Subscribes to an event on an Events source and returns the raw EventRef (parity with Events.on). Typed wrapper: the event name and callback arguments are autocompleted from the source’s overloads.

Import:

import { subscribeEvent } from '@mnaoumov/obsidian-lib/events';

Signature:

function subscribeEvent(params: SubscribeEventParams<Source, EventName>): EventRef

Parameters:

Parameter Type Description
params SubscribeEventParams<Source, EventName> The subscription parameters.

Returns: EventRef — The EventRef for the registered handler.


Links to this page: