I found two ways to do it. Prototype has a periodical executer class
in it:
====================
{
peObj = new PeriodicalExecuter( this.peMethod, 1 ); // every
second
peObj._peCount = 0;
},
peMethod: function(peObj) {
$('debug').innerHTML += peObj._peCount + ' : peMethod<br/>';
peObj._peCount++;
if( peObj._peCount > 5 ) {
peObj.stop();
}
},
=====================
But I don't see how that class is any easier than this:
=====================
{
this.timerCount = 0;
this.timer = setInterval( this.timerMethod.bind( this ),
1000 ); // every second
}
timerMethod: function() {
$('debug').innerHTML += this.timerCount + ' : timerMethod<br/>';
this.timerCount++;
if( this.timerCount > 5 ) {
clearInterval( this.timer );
}
},
=====================
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---