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 '@mnaoumov/typescript-lib/disposable';

Signature:

export class DisposableBase implements DisposableEx

Implements: DisposableEx

Properties

PropertyTypeDescription
dispose() => voidDisposes the object. Delegates to this[Symbol.dispose]().
(Inherited from DisposableEx)
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: