Skip to content

Instantly share code, notes, and snippets.

@Xorcerer
Created April 18, 2014 08:47
Show Gist options
  • Save Xorcerer/11032262 to your computer and use it in GitHub Desktop.
Save Xorcerer/11032262 to your computer and use it in GitHub Desktop.
var wait = require('wait.for');
var request = require("request");
function test(){
var resp = wait.for(request.get, "http://google.com");
console.log('Got google.com.');
var resp = wait.for(request.get,"http://yahoo.com");
console.log('Got yahoo.');
}
for (var i = 1; i < 20; i += 1) {
(function () {
var sec = i;
setTimeout(function() { console.log('at ' + sec + ' s.'); }, sec * 1000);
})();
}
wait.launchFiber(test);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment