Created
August 23, 2015 01:12
-
-
Save buren/4110ef29104bdf90ab2e to your computer and use it in GitHub Desktop.
Dead simple JS repeater
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
/* | |
* Repeater.js | |
*/ | |
(function (window) { | |
'use strict'; | |
function Repeater(callback, timeout) { | |
var self = this; | |
var update = callback; | |
self.runner = setInterval(function () { update(); }, timeout); | |
self.stop = function () { clearInterval(self.runner); }; | |
}; | |
window.Repeater = Repeater; | |
}(window)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment