Skip to content

Instantly share code, notes, and snippets.

@tlrobinson
Created March 2, 2015 16:50
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 tlrobinson/756682ae0b260ff2f38a to your computer and use it in GitHub Desktop.
Save tlrobinson/756682ae0b260ff2f38a to your computer and use it in GitHub Desktop.
import Promise from "q"
function* getAsyncIterator() {
for (let i = 0; i < 10; i++) {
yield Promise.resolve(i).delay(250);
}
}
Promise.async(function*() {
for (let p of getAsyncIterator()) {
let val = yield p;
console.log(val);
}
})().done();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment