Last active
October 26, 2018 10:32
-
-
Save kievsash/de5127dc23cbc8d5148becb9db8a4a20 to your computer and use it in GitHub Desktop.
'of' with observeOn + asyncScheduler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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