Skip to content

subscribeAsyncDisposableEvent<Source, EventName>

Subscribes to an event on an AsyncEventSource and returns an AsyncDisposableEx that unregisters it on dispose. Async counterpart of the native subscribeDisposableEvent; the event name and callback argument types are inferred from the source’s event map.

Import:

import { subscribeAsyncDisposableEvent } from 'obsidian-dev-utils/async-events';

Signature:

function subscribeAsyncDisposableEvent(params: SubscribeAsyncDisposableEventParams<Source, EventName>): AsyncDisposableEx

Parameters:

ParameterTypeDescription
paramsSubscribeAsyncDisposableEventParams<Source, EventName>The subscription parameters.

Returns: AsyncDisposableEx — An AsyncDisposableEx that unregisters the handler when disposed.


Links to this page: