Skip to content

Instantly share code, notes, and snippets.

@kievsash
Created October 26, 2018 10:24
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 kievsash/70d49a54e685bdda2d737134a368efbb to your computer and use it in GitHub Desktop.
Save kievsash/70d49a54e685bdda2d737134a368efbb to your computer and use it in GitHub Desktop.
rx.js, 'of' argument scheduler
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, asyncScheduler).pipe(
tap((v) => console.log('tap ', v))
)
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