Skip to content

toAsyncDisposableEx

Adapts a plain AsyncDisposable into an AsyncDisposableEx by adding a convenience AsyncDisposableEx.asyncDispose method that delegates to Symbol.asyncDispose.

If the object already implements AsyncDisposableEx, it is returned unchanged.

Import:

import { toAsyncDisposableEx } from '@mnaoumov/typescript-lib/disposable';

Signature:

function toAsyncDisposableEx(asyncDisposable: AsyncDisposable): AsyncDisposableEx

Parameters:

Parameter Type Description
asyncDisposable AsyncDisposable the async disposable to adapt

Returns: AsyncDisposableEx — An AsyncDisposableEx wrapping the async disposable.