Skip to content

Instantly share code, notes, and snippets.

@jooyunghan
Created December 20, 2017 16:02
Show Gist options
  • Save jooyunghan/2b2a6ab48623e9de113fc99228044723 to your computer and use it in GitHub Desktop.
Save jooyunghan/2b2a6ab48623e9de113fc99228044723 to your computer and use it in GitHub Desktop.
async function consume(obs) {
try {
for await (const n of obs) {
console.log(n);
}
} catch (e) {
console.log('got it', e.message);
}
console.log('done');
}
consume(Observable.interval(100).do(n => console.assert(n < 5)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment