Skip to content

Instantly share code, notes, and snippets.

@groundwater
Created March 27, 2015 01:44
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 groundwater/4a9b272c556ad22ccd43 to your computer and use it in GitHub Desktop.
Save groundwater/4a9b272c556ad22ccd43 to your computer and use it in GitHub Desktop.
let sink = async function(iter) {
for (let item of iter) {
console.log('got', await item)
}
}
sink(function*(){
var i = 0
while(true) {
yield new Promise(done => {
setTimeout(done, 1000, i++)
})
}
}())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment