Skip to content

Instantly share code, notes, and snippets.

@davetapley
Last active December 16, 2015 22:18
Show Gist options
  • Save davetapley/5505590 to your computer and use it in GitHub Desktop.
Save davetapley/5505590 to your computer and use it in GitHub Desktop.
Keep doing work until told to stop.
var timer,
work = function () {
asyncWork(function(err) {
timer = setTimeout(work, 10000);
}
},
exports.start = function () {
work();
},
exports.stop = function () {
clearTimeout(timer);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment