PeriodicalExecuter.prototype.registerCallback = function() {All it does is take the current registerCallback function (which creates the actual timer) and stores its returned interval ID which we then use in the new stop function with the native clearInterval method.
this.intervalID = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
}
PeriodicalExecuter.prototype.stop = function() {
clearInterval(this.intervalID);
}
Complete article is here: http://www.metalmadness.co.uk/Blog/archive/2006/01/09/801.aspx