Skip to content

Latest commit

 

History

History
72 lines (58 loc) · 2.6 KB

debouncewithselector.md

File metadata and controls

72 lines (58 loc) · 2.6 KB

Rx.Observable.prototype.debounceWithSelector(durationSelector)

Rx.Observable.prototype.throttleWithSelector(durationSelector) DEPRECATED

Ignores values from an observable sequence which are followed by another value within a computed debounced duration.

Arguments

  1. durationSelector (Function): Selector function to retrieve a sequence indicating the throttle duration for each given element.

Returns

(Observable): The throttled sequence.

Example

var array = [
    800,
    700,
    600,
    500
];

var source = Rx.Observable.for(
    array,
    function (x) {
        return Rx.Observable.timer(x)
    })
    .map(function(x, i) { return i; })
    .debounceWithSelector(function (x) {
        return Rx.Observable.timer(700);
    });

var subscription = source.subscribe(
    function (x) {
        console.log('Next: ' + x);
    },
    function (err) {
        console.log('Error: ' + err);
    },
    function () {
        console.log('Completed');
    });

// => Next: 0
// => Next: 3
// => Completed

Location

File:

Dist:

Prerequisites:

NPM Packages:

NuGet Packages:

Unit Tests: