Skip to content

Latest commit

 

History

History
63 lines (49 loc) · 2.58 KB

pausablebuffered.md

File metadata and controls

63 lines (49 loc) · 2.58 KB

Rx.Observable.prototype.pausableBuffered(pauser)

Pauses the underlying observable sequence based upon the observable sequence which yields true/false, and yields the values that were buffered while paused. Note that this only works on hot observables.

Arguments

  1. pauser (Observable): The observable sequence used to pause the underlying sequence.

Returns

(Observable): The observable sequence which is paused based upon the pauser.

Example

var pauser = new Rx.Subject();
var source = Rx.Observable.interval(1000).pausableBuffered(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();

// Resume the flow which empties the queue from when you last paused
pauser.onNext(true); // or source.resume();

Location

File:

Dist:

Prerequisites:

NPM Packages:

NuGet Packages:

Unit Tests: