Skip to content

Instantly share code, notes, and snippets.

@lele85
Created March 13, 2012 19:35
Show Gist options
  • Save lele85/2031026 to your computer and use it in GitHub Desktop.
Save lele85/2031026 to your computer and use it in GitHub Desktop.
setTimeout
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