Skip to content

Instantly share code, notes, and snippets.

@adjohu
Created February 26, 2013 09:27
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 adjohu/5037246 to your computer and use it in GitHub Desktop.
Save adjohu/5037246 to your computer and use it in GitHub Desktop.
var createPoller = function (pollFunc, interval) {
var timeout;
var poll = function () {
pollFunc();
timeout = setTimeout(poll, interval);
};
return {
start: function () {
poll();
},
stop: function () {
clearTimeout(timeout);
}
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment