Skip to content

Instantly share code, notes, and snippets.

@SergioLaRosa
Created April 19, 2019 15:39
Show Gist options
  • Save SergioLaRosa/d9c3635845145bcbbb074ad264ab25b6 to your computer and use it in GitHub Desktop.
Save SergioLaRosa/d9c3635845145bcbbb074ad264ab25b6 to your computer and use it in GitHub Desktop.
A better setTimeout
//credits to: https://ilinkuo.wordpress.com/2014/01/05/a-better-settimeout/
function setTimeout3(callback, delay){
var handle = new Number(setTimeout(callback, delay));
handle.clear = function(){clearTimeout(handle);};
return handle;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment