Debounce is known-a rate-limiting operator, but it's not the only one. This lessons introduces-throttletime and throttle, which only drop events (without delaying them) to accomplish rat E limiting.
Throttletime (number): first emits, then cause silence
var foo = Rx.Observable.interval ($). Take (5); /* --0--1--2--3--4| Debouncetime (+)//waits for silence, then emits throttletime (+)//first emits, then causes silence--0-----2--- --4| */ var result = Foo.throttletime (+); Result.subscribe ( function (x) {Console.log (' Next ' + x '); }, function (err) {console.log (' error ' + err);}, function () { Console.log (' Done ');},);
Throttle (() = Observable):
var foo = Rx.Observable.interval ($). Take (5); /* --0--1--2--3--4| Throttle (() = Rx.Observalbe.interval (1))//first emits, then causes silence--0-----2-----4| */ var result = Foo.throttle (() = Rx.Observable.interval (+). Take (1)); Result.subscribe ( function (x) {Console.log (' next ' + x);}, function (err) {console.log (' error ' + err);}, /c13>function () {console.log (' done ');},);
Result for both:
/* "Next 0" "Next 2" "Next 4" "Done" */
[RxJS] Filtering Operators:throttle and Throttletime