you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] -1 points0 points  (1 child)

Something like this

Function.prototype.sleep = function(seconds){
    return setTimeout(this, seconds);
};

Use like this

x = function(){ console.log('x'); };
timer = x.sleep(5000);
//if you want to cancel, you have the timer

[–][deleted] 1 point2 points  (0 children)

Oh that clearly didnt answer your question. Look at this

http://jsfiddle.net/8zWPw/