Here you can find the source of Delay(function)
window.Delay = (function(){ var timer = 0; return function(callback, ms){ clearTimeout (timer);// w w w . j a v a 2 s .c o m timer = setTimeout(callback, ms); }; })();
Function.prototype.delay = function(timeout){ return setTimeout(this, timeout); };