instance method PeriodicalExecuter#stop

View source on GitHub →

PeriodicalExecuter#stop() → undefined

Stops the periodical executer (there will be no further triggers).

Once a PeriodicalExecuter is created, it constitues an infinite loop, triggering at the given interval until the page unloads. This method lets you stop it any time you want.


This will only alert 1, 2 and 3, then the PeriodicalExecuter stops.

var count = 0;
new PeriodicalExecuter(function(pe) {
  if (++count > 3) {
  } else {
}, 1);