Pauses the underlying observable sequence based upon the observable sequence which yields true/false. Note that this only works on hot observables.
pauser
(Observable
): The observable sequence used to pause the underlying sequence.
(Observable
): The observable sequence which is paused based upon the pauser.
var pauser = new Rx.Subject();
var source = Rx.Observable.fromEvent(document, 'mousemove').pausable(pauser);
var subscription = source.subscribe(
function (x) {
console.log('Next: ' + x.toString());
},
function (err) {
console.log('Error: ' + err);
},
function () {
console.log('Completed');
});
// To begin the flow
pauser.onNext(true); // or source.resume();
// To pause the flow at any point
pauser.onNext(false); // or source.pause();
File:
Dist:
Prerequisites:
- If using
rx.backpressure.js
NPM Packages:
NuGet Packages:
Unit Tests: