Created
May 15, 2014 09:55
-
-
Save MiguelDebruyne/e5ff83e9e29b6c8ee53e to your computer and use it in GitHub Desktop.
JavaScript: Interval Method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Interval (fn, time) | |
{ | |
var timer = false; | |
this.start = function () { | |
if (!this.isRunning()) { | |
timer = setInterval(fn, time); | |
} | |
}; | |
this.stop = function () { | |
clearInterval(timer); | |
timer = false; | |
}; | |
this.isRunning = function () { | |
return timer !== false; | |
}; | |
// var blaInterval = new Interval(functionName, time); | |
// blaInterval.start(); | |
// blaInterval.stop(); | |
// if (blaInterval.isRunning()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment