[jQuery] PeriodicalExecutor or $.executeEach
Hi folks,
I've been using jQuery for a while and it's great. However - there is
no such thing as a PeriodicalExecutor or how to take actions every N
amount of time... So I sat down and wrote one. :) Here it is.
// jQuery plugin for periodical execution.
// Pass the function the seconds and the function and it will call the
function every N seconds,
// use this.stop() to stop the execution.
jQuery.executeEach = function (seconds, fn) {
var scope = {
stop: function () { clearTimeout(this.timer); },
timer: setInterval(function () { fn(scope); } , seconds)
};
};
I wanted to share it with you and hear your thoughts. I would like it
to be released in some form (plugin or in the framework itself).
Also, I was wondering how do you implement such functionality for the
effects?
Regards,
Emil Ivanov