throttleTime

RxJS 5 throttleTime

by Brian Troncone

HTML

<script src="https://npmcdn.com/@reactivex/rxjs@5.0.0-beta.8/dist/global/Rx.umd.js"></script>

JavaScript

//emit value every 1 second
const source = Rx.Observable.interval(1000);
/*
  throttle for five seconds
  last value emitted before throttle ends will be emitted from source
*/
const example = source
  .throttleTime(5000);
//output: 0...6...12
const subscribe = example.subscribe(val => console.log(val));