Created
March 13, 2012 19:35
-
-
Save lele85/2031026 to your computer and use it in GitHub Desktop.
setTimeout
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 count = 1; | |
var ping = function(cb){ | |
setTimeout(function() | |
{ | |
console.log("P....... " + count * 200 + "ms"); | |
count++; | |
cb(ping); | |
},200); | |
} | |
var pong = function(cb){ | |
setTimeout(function() | |
{ | |
console.log(".......P "+ count * 200 + "ms"); | |
count++; | |
cb(pong); | |
},200); | |
} | |
var smash_timeout = 1030; | |
var smash = function(){ | |
console.log("<-------------------- " + smash_timeout + "ms"); | |
}; | |
ping(pong); | |
setTimeout(smash,smash_timeout); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment