Provides a set of static methods for creating Disposables, which defines a method to release allocated resources.
The follow example shows the basic usage of an Disposable.
const disposable = Disposable.create(() => console.log('disposed'));
disposable.dispose();
// => disposedCreates a disposable object that invokes the specified action when disposed.
actionFunction: Function to run during the first call todispose. The action is guaranteed to be run at most once.
Disposable: The disposable object that runs the given action upon disposal.
const disposable = Disposable.create(() => console.log('disposed'));
disposable.dispose();
// => disposedCreates a disposable object that invokes the specified action when disposed.
d:Object- Object to validate whether it has a dispose method.
Boolean - true if is a disposable object, else false.
const disposable = Disposable.empty;
console.log(Disposable.isDisposable(disposable));
// => trueGets the disposable that does nothing when disposed.
Disposable: The disposable that does nothing when disposed.
const disposable = Disposable.empty;
disposable.dispose(); // Does nothingPerforms the task of cleaning up resources.
const disposable = Disposable.create(() => console.log('disposed'));
disposable.dispose();
// => disposed