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 'obsidian-dev-utils/obsidian/events';

Signature:

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

Parameters:

ParameterTypeDescription
paramsSubscribeDisposableEventParams<Source, EventName>The subscription parameters.

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


Links to this page: