pairwise

signature: pairwise(): Observable<Array>

Emit the previous and current values as an array.

Examples

Example 1:

( jsBin | jsFiddle )

var interval = Rx.Observable.interval(1000);

//Returns: [0,1], [1,2], [2,3], [3,4], [4,5]
interval.pairwise()
    .take(5)
    .subscribe(console.log);

Additional Resources


:file_folder: Source Code: https://github.com/ReactiveX/rxjs/blob/master/src/operator/pairwise.ts

results matching ""

    No results matching ""