Represents an immutable group of disposable resources that are disposed together.
The follow example shows the basic usage of a NAryDisposable
.
const d1 = Disposable.create(() => console.log('one'));
const d2 = Disposable.create(() => console.log('two'));
const d3 = Disposable.create(() => console.log('three'));
// Initialize with two disposables
const disposables = new NAryDisposable([d1, d2, d3]);
disposables.dispose();
// => one
// => two
// => three
Creates a new group of disposable resources that are disposed together.
disposables
:Array
- Disposables that will be disposed together.
const d1 = Disposable.create(() => console.log('one'));
const d2 = Disposable.create(() => console.log('two'));
const d3 = Disposable.create(() => console.log('three'));
// Initialize with two disposables
const disposables = new NAryDisposable([d1, d2, d3]);
disposables.dispose();
// => one
// => two
// => three
Disposes the underlying disposables.
const d1 = Disposable.create(() => console.log('one'));
const d2 = Disposable.create(() => console.log('two'));
const d3 = Disposable.create(() => console.log('three'));
// Initialize with two disposables
const disposables = new NAryDisposable([d1, d2, d3]);
disposables.dispose();
// => one
// => two
// => three
Gets a value that indicates whether the object is disposed.
const d1 = Disposable.create(() => console.log('one'));
const d2 = Disposable.create(() => console.log('two'));
const d3 = Disposable.create(() => console.log('three'));
const disposables = new NAryDisposable([d1, d2, d3]);
console.log(disposables.isDisposed);
// => false
disposables.dispose();
// => disposed
console.log(disposables.isDisposed);
// => true