Skip to content

Instantly share code, notes, and snippets.

@nlharri
Last active November 17, 2018 09:12
Show Gist options
  • Save nlharri/45dfaa95d956a5224c0bd0a50431ce12 to your computer and use it in GitHub Desktop.
Save nlharri/45dfaa95d956a5224c0bd0a50431ce12 to your computer and use it in GitHub Desktop.
RxJS Tutorial - throttleTime()
const { interval } = require('rxjs')
const { throttleTime } = require('rxjs/operators');
// emit value every 500 millisecond (0.5 second)
const myObserver = interval(500);
const myThrottledObserver = myObserver.pipe(throttleTime(1000));
myThrottledObserver.subscribe(val => console.log(val));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment