Skip to content

Instantly share code, notes, and snippets.

@yringler
Created December 17, 2021 16:36
Show Gist options
  • Save yringler/d07f77011cac69e614de78f91982371e to your computer and use it in GitHub Desktop.
Save yringler/d07f77011cac69e614de78f91982371e to your computer and use it in GitHub Desktop.
const { rxObserver } = require('api/v0.3');
const { timer } = require('rxjs');
const { take, map, shareReplay, tap } = require('rxjs/operators');
const source = timer(10, 10)
.pipe(
map(time => `${time} deciseconds`),
take(5),
tap (x => console.log(x)),
shareReplay(1)
);
timer(10, 10).pipe(take(10)).subscribe(() => {
let message = '0';
source.pipe(take(1)).subscribe(val => {
message = val
});
rxObserver(message)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment