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- rx.js
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- rx.js
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- rx.js
Performs the task of cleaning up resources.
var disposable = Rx.Disposable.create(function () {
console.log('disposed');
});
disposable.dispose();
// => disposed- rx.js