Skip to content

Instantly share code, notes, and snippets.

@buren
Created August 23, 2015 01:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save buren/4110ef29104bdf90ab2e to your computer and use it in GitHub Desktop.
Save buren/4110ef29104bdf90ab2e to your computer and use it in GitHub Desktop.
Dead simple JS repeater
/*
* 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