Skip to content

subscribeDisposableEvent<Source, EventName>

Subscribes to an event on an Events source and returns a DisposableEx that unregisters it on dispose. Typed wrapper over Events.on: the event name and callback arguments are autocompleted from the source’s overloads.

Import:

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

Signature:

function subscribeDisposableEvent(params: SubscribeDisposableEventParams<Source, EventName>): DisposableEx

Parameters:

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

Returns: DisposableEx — A DisposableEx that unregisters the handler when disposed.


Links to this page: