Skip to content

Latest commit

 

History

History
71 lines (57 loc) · 2.47 KB

debouncewithselector.md

File metadata and controls

71 lines (57 loc) · 2.47 KB

Rx.Observable.prototype.debounceWithSelector(durationSelector)

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: %s', x);
  },
  function (err) {
    console.log('Error: %s', err);
  },
  function () {
    console.log('Completed');
  });

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

Location

File:

Dist:

Prerequisites:

NPM Packages:

NuGet Packages:

Unit Tests: