@lumino/disposable
- Version 2.1.3
- Published
- 52.6 kB
- 1 dependency
- BSD-3-Clause license
Install
npm i @lumino/disposable
yarn add @lumino/disposable
pnpm add @lumino/disposable
Overview
disposable
Index
Classes
Interfaces
Namespaces
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.
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.
class ObservableDisposableSet
class ObservableDisposableSet extends DisposableSet implements IObservableDisposable {}
An observable object which manages a collection of disposable items.
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: Iterable<IDisposable>) => DisposableSet;
Create a disposable set from an iterable of items.
Parameter items
The iterable 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: Iterable<IDisposable>) => ObservableDisposableSet;
Create an observable disposable set from an iterable of items.
Parameter items
The iterable object of interest.
Returns
A new disposable initialized with the given items.
Package Files (1)
Dependencies (1)
Dev Dependencies (18)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto 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/@lumino/disposable
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@lumino/disposable)
- HTML<a href="https://www.jsdocs.io/package/@lumino/disposable"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 3213 ms. - Missing or incorrect documentation? Open an issue for this package.