Skip to content

disposeAsync

Disposes an AsyncDisposable.

Prefer this over calling asyncDisposable[Symbol.asyncDispose]() at the call site: it reads better and keeps the well-known symbol referenced in a single place.

Import:

import { disposeAsync } from 'obsidian-dev-utils/disposable';

Signature:

function disposeAsync(asyncDisposable: AsyncDisposable): Promise<void>

Parameters:

ParameterTypeDescription
asyncDisposableAsyncDisposablethe async disposable to dispose

Returns: Promise<void> — A Promise that resolves once the disposal completes.