@phosphor/disposable

  • Version 1.3.1
  • Published
  • 15.9 kB
  • 2 dependencies
  • BSD-3-Clause license

Install

npm i @phosphor/disposable
yarn add @phosphor/disposable
pnpm add @phosphor/disposable

Overview

PhosphorJS - Disposable

Index

Classes

class DisposableDelegate

class DisposableDelegate implements IDisposable {}
  • A disposable object which delegates to a callback function.

constructor

constructor(fn: () => void);
  • Construct a new disposable delegate.

    Parameter fn

    The callback function to invoke on dispose.

property isDisposed

readonly isDisposed: boolean;
  • Test whether the delegate has been disposed.

method dispose

dispose: () => void;
  • Dispose of the delegate and invoke the callback function.

class DisposableSet

class DisposableSet implements IDisposable {}
  • An object which manages a collection of disposable items.

constructor

constructor();
  • Construct a new disposable set.

property isDisposed

readonly isDisposed: boolean;
  • Test whether the set has been disposed.

method add

add: (item: IDisposable) => void;
  • Add a disposable item to the set.

    Parameter item

    The item to add to the set.

    #### Notes If the item is already contained in the set, this is a no-op.

method clear

clear: () => void;
  • Remove all items from the set.

method contains

contains: (item: IDisposable) => boolean;
  • Test whether the set contains a specific item.

    Parameter item

    The item of interest.

    Returns

    true if the set contains the item, false otherwise.

method dispose

dispose: () => void;
  • Dispose of the set and the items it contains.

    #### Notes Items are disposed in the order they are added to the set.

method remove

remove: (item: IDisposable) => void;
  • Remove a disposable item from the set.

    Parameter item

    The item to remove from the set.

    #### Notes If the item is not contained in the set, this is a no-op.

class ObservableDisposableDelegate

class ObservableDisposableDelegate
extends DisposableDelegate
implements IObservableDisposable {}
  • An observable disposable object which delegates to a callback function.

property disposed

readonly disposed: any;
  • A signal emitted when the delegate is disposed.

method dispose

dispose: () => void;
  • Dispose of the delegate and invoke the callback function.

class ObservableDisposableSet

class ObservableDisposableSet
extends DisposableSet
implements IObservableDisposable {}
  • An observable object which manages a collection of disposable items.

property disposed

readonly disposed: any;
  • A signal emitted when the set is disposed.

method dispose

dispose: () => void;
  • Dispose of the set and the items it contains.

    #### Notes Items are disposed in the order they are added to the set.

Interfaces

interface IDisposable

interface IDisposable {}
  • An object which implements the disposable pattern.

property isDisposed

readonly isDisposed: boolean;
  • Test whether the object has been disposed.

    #### Notes This property is always safe to access.

method dispose

dispose: () => void;
  • Dispose of the resources held by the object.

    #### Notes If the object's dispose method is called more than once, all calls made after the first will be a no-op.

    #### Undefined Behavior It is undefined behavior to use any functionality of the object after it has been disposed unless otherwise explicitly noted.

interface IObservableDisposable

interface IObservableDisposable extends IDisposable {}
  • A disposable object with an observable disposed signal.

property disposed

readonly disposed: ISignal<this, void>;
  • A signal emitted when the object is disposed.

Namespaces

namespace DisposableSet

namespace DisposableSet {}
  • The namespace for the DisposableSet class statics.

function from

from: (items: any) => DisposableSet;
  • Create a disposable set from an iterable of items.

    Parameter items

    The iterable or array-like object of interest.

    Returns

    A new disposable initialized with the given items.

namespace ObservableDisposableSet

namespace ObservableDisposableSet {}
  • The namespace for the ObservableDisposableSet class statics.

function from

from: (items: any) => ObservableDisposableSet;
  • Create an observable disposable set from an iterable of items.

    Parameter items

    The iterable or array-like object of interest.

    Returns

    A new disposable initialized with the given items.

Package Files (1)

Dependencies (2)

Dev Dependencies (14)

Peer Dependencies (0)

No peer dependencies.

Badge

To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@phosphor/disposable.

  • Markdown
    [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@phosphor/disposable)
  • HTML
    <a href="https://www.jsdocs.io/package/@phosphor/disposable"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>