Created
March 27, 2015 01:44
-
-
Save groundwater/4a9b272c556ad22ccd43 to your computer and use it in GitHub Desktop.
This file contains 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 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