Skip to content

Instantly share code, notes, and snippets.

@fillano
Created March 30, 2014 02:56
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 fillano/9866723 to your computer and use it in GitHub Desktop.
Save fillano/9866723 to your computer and use it in GitHub Desktop.
function * gen() {
var c = 0;
while(true) {
yield c;
c++;
}
}
function run() {
var g = gen();
setInterval(function() {console.log(g.next().value)}, 3000);
setInterval(function() {console.log(new Date().getTime())}, 1000);
}
run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment