Skip to content

DisposableBase

Abstract base for a DisposableEx: it carries the re-dispose guard (via MultipleDisposeBehavior) and the DisposableEx.dispose alias; a subclass only implements DisposableBase.performDispose.

Import:

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

Signature:

export class DisposableBase implements DisposableEx

Implements: DisposableEx

Properties

PropertyTypeDescription
multipleDisposeBehaviorMultipleDisposeBehaviorHow the disposable behaves when disposed more than once.

Methods

MethodReturnsDescription
[Symbol.dispose]()voidDisposes the object by running DisposableBase.performDispose, honoring the configured MultipleDisposeBehavior on a repeat dispose.
dispose()voidDisposes the object. Convenience alias that delegates to this[Symbol.dispose]().
performDispose()voidPerforms the actual teardown. Called at most once unless MultipleDisposeBehavior.Invoke is set.

Links to this page: