Created
February 6, 2020 09:11
-
-
Save jfet97/5d8e4d740781bc3aa54e053d06eec27a to your computer and use it in GitHub Desktop.
AsyncIterators RxJS
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
const ticker = interval(1000).pipe(take(100)); | |
function snooze(ms) { | |
return new Promise(resolve => setTimeout(snooze, ms)); | |
} | |
async function* values() { | |
for await (const number of ticker) { | |
await snooze(2000); | |
yield number; | |
} | |
} | |
from(values()).subscribe(x => console.log(x)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment