Skip to content

Instantly share code, notes, and snippets.

@kosich
Created April 4, 2019 10:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kosich/cca5146802c43c401e4742c7b6e96340 to your computer and use it in GitHub Desktop.
Save kosich/cca5146802c43c401e4742c7b6e96340 to your computer and use it in GitHub Desktop.
combineLatest with timers
const { rxObserver } = require('api/v0.3');
const { timer, combineLatest } = require('rxjs');
const { map, take } = require('rxjs/operators');
const timerOne = timer(100, 400);
const timerTwo = timer(200, 400);
const timerThree = timer(300, 400);
timerOne.subscribe(rxObserver());
timerTwo.subscribe(rxObserver());
timerThree.subscribe(rxObserver());
combineLatest(timerOne, timerTwo, timerThree, (...arr)=>arr.join('-'))
.subscribe(rxObserver());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment