Using Prototype.js and PeriodicalExecuter
This quick tutorial will show you how to get started using prototype’s PeriodicalExecuter object. This object is useful for for when you have to repeat a function with a set interval. We will make a simple application that will alert the user an incremented message every 5 seconds.
Here is the code:
var i = 0;
function showMsg () {
alert(i);
i++;
}
new PeriodicalExecuter(showMsg, 5);The first parameter the object takes is the function name (with no parameters) and secondly the interval of time in seconds. We will be exploring this object more in our upcoming workshop.
About this entry
You’re currently reading “Using Prototype.js and PeriodicalExecuter,” an entry on Ajax Lessons

- 2.15.06 / 1am

3 Comments
Jump to comment form | comments rss [?] | trackback uri [?]