Represents an immutable group of two disposable resources that are disposed together.
The follow example shows the basic usage of a BinaryDisposable
.
const d1 = Disposable.create(() => console.log('one'));
const d2 = Disposable.create(() => console.log('two'));
// Initialize with two disposables
const disposables = new BinaryDisposable(d1, d2);
disposables.dispose();
// => one
// => two
Creates a new group of two disposable resources that are disposed together.
first
:Disposable
- The first disposable resource to add to the group.second
:Disposable
- The second disposable resource to add to the group.
const d1 = Disposable.create(() => console.log('one'));
const d2 = Disposable.create(() => console.log('two'));
// Initialize with two disposables
const disposables = new BinaryDisposable(d1, d2);
disposables.dispose();
// => one
// => two
Disposes the underlying disposables.
const d1 = Disposable.create(() => console.log('one'));
const d2 = Disposable.create(() => console.log('two'));
const disposables = new BinaryDisposable(d1, d2);
disposables.dispose();
// => one
// => two
console.log(disposables.length);
// => 0
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 disposables = new BinaryDisposable(d1, d2);
console.log(disposables.isDisposed);
// => false
disposables.dispose();
// => disposed
console.log(disposables.isDisposed);
// => true