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 Rx.Disposable
.
var disposable = Rx.Disposable.create(function () {
console.log('disposed');
});
disposable.dispose();
// => disposed
# [Ⓢ](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 todispose
. 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:
- None
NPM Packages:
NuGet Packages:
Unit Tests:
# [Ⓢ](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:
- None
NPM Packages:
NuGet Packages:
Unit Tests:
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:
- None
NPM Packages:
NuGet Packages:
Unit Tests:
Performs the task of cleaning up resources.
var disposable = Rx.Disposable.create(function () {
console.log('disposed');
});
disposable.dispose();
// => disposed
File:
Dist:
Prerequisites:
- None
NPM Packages:
NuGet Packages:
Unit Tests: