Skip to content

AsyncDisposableBase

Abstract base for an AsyncDisposableEx: it carries the re-dispose guard (via MultipleDisposeBehavior) and the AsyncDisposableEx.asyncDispose alias; a subclass only implements AsyncDisposableBase.performDisposeAsync.

Import:

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

Signature:

export class AsyncDisposableBase implements AsyncDisposableEx

Implements: AsyncDisposableEx

Properties

PropertyTypeDescription
multipleDisposeBehaviorMultipleDisposeBehaviorHow the disposable behaves when disposed more than once.

Methods

MethodReturnsDescription
[Symbol.asyncDispose]()Promise<void>Disposes the object by running AsyncDisposableBase.performDisposeAsync, honoring the configured MultipleDisposeBehavior on a repeat dispose.
asyncDispose()Promise<void>Disposes the object. Convenience alias that delegates to this[Symbol.asyncDispose]().
performDisposeAsync()Promisable<void>Performs the actual teardown. Called at most once unless MultipleDisposeBehavior.Invoke is set.

Links to this page: