Created
April 18, 2014 08:47
-
-
Save Xorcerer/11032262 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
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