doc/api/disposables/disposable.md
Rx.Disposable classProvides 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 Rx.Disposable.
var disposable = Rx.Disposable.create(function () {
console.log('disposed');
});
disposable.dispose();
// => disposed
Disposable Class MethodsDisposable Class PropertiesDisposable Instance MethodsRx.Disposable.create(action)<a href="#rxdisposablecreateaction">#</a> [Ⓢ](https://github.com/Reactive-Extensions/RxJS/blob/master/src/core/disposables/disposable.js"View in source")
Creates a disposable object that invokes the specified action when disposed.
action (Function): Function to run during the first call to dispose. The action is guaranteed to be run at most once.(Disposable): The disposable object that runs the given action upon disposal.
var disposable = Rx.Disposable.create(function () {
console.log('disposed');
});
disposable.dispose();
// => disposed
File:
Dist:
Prerequisites:
NPM Packages:
NuGet Packages:
Unit Tests:
Rx.Disposable.isDisposable(d)<a href="#rxdisposableisdisposabled">#</a> [Ⓢ](https://github.com/Reactive-Extensions/RxJS/blob/master/src/core/disposables/disposable.js"View in source")
Creates 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.
var disposable = Rx.Disposable.empty;
console.log(disposable.isDisposable(disposable));
// => true
File:
Dist:
Prerequisites:
NPM Packages:
NuGet Packages:
Unit Tests:
Rx.Disposable.empty<a href="#rxdisposableempty">#</a> Ⓢ
Gets the disposable that does nothing when disposed.
(Disposable): The disposable that does nothing when disposed.
var disposable = Rx.Disposable.empty;
disposable.dispose(); // Does nothing
File:
Dist:
Prerequisites:
NPM Packages:
NuGet Packages:
Unit Tests:
Rx.Disposable.prototype.dispose()<a href="#rxdisposableprototypedispose">#</a> Ⓢ
Performs the task of cleaning up resources.
var disposable = Rx.Disposable.create(function () {
console.log('disposed');
});
disposable.dispose();
// => disposed
File:
Dist:
Prerequisites:
NPM Packages:
NuGet Packages:
Unit Tests: