Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correction throttleFirst to throttle #76

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ debounced.subscribeOnNext(value => console.log('Input value: %s', value));

### Throttling ###

Another technique to deal with an observable sequence which is producing too much for the consumer is through throttling with the use of the [`throttleFirst`](https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/operators/throttlefirst.md) method which emits the first items emitted by an Observable within periodic time intervals. Throttling can be especially useful for rate limiting execution of handlers on events like resize and scroll.
Another technique to deal with an observable sequence which is producing too much for the consumer is through throttling with the use of the [`throttle`](https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/operators/throttle.md) method which emits the first items emitted by an Observable within periodic time intervals. Throttling can be especially useful for rate limiting execution of handlers on events like resize and scroll.

```js
var throttled = Rx.Observable.fromEvent(window, 'resize')
.throttleFirst(250 /* ms */);
.throttle(250 /* ms */);

throttled.subscribeOnNext(e => {
console.log('Window inner height: %d', window.innerHeight);
Expand Down