Skip to content

Instantly share code, notes, and snippets.

@xperiments xperiments/interlval.js
Last active Feb 13, 2018

What would you like to do?
[[js][hacks]] Better setInterval #js #hacks #tips
function interval(func, wait, times){
var interv = function(w, t){
return function(){
if(typeof t === "undefined" || t-- > 0){
setTimeout(interv, w);
t = 0;
throw e.toString();
}(wait, times);
setTimeout(interv, wait);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.