Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
'of' with observeOn + asyncScheduler
let Rx = window['rxjs'];
const {of,
queueScheduler,
asapScheduler,
asyncScheduler,
animationFrameScheduler
} = Rx;
const {observeOn, tap} = Rx.operators;
console.clear();
setTimeout(() => console.log('It will runs just after this Macrotask'))
let source$ = of(1, 2, 3).pipe(
tap((v) => console.log('tap ', v)),
observeOn(asyncScheduler)
)
source$.subscribe((v) => {
console.log('Value ', v);
Promise.resolve().then(() => console.log('Microtask value ', v));
setTimeout(() => console.log('MAcrotask value ', v), 0);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.