Skip to content

Latest commit

 

History

History
39 lines (24 loc) · 991 Bytes

File metadata and controls

39 lines (24 loc) · 991 Bytes

Loop

Loop

A Utility Class. Its methods can be implemented with Class-implement into any Class. Used to run a class method on a periodical.

Useful in galleries, slideshows, tickers, sprite animations, pulsing, logout scripts, etc. Anything that needs to run the same function repeatedly.

How to use

Example:

#JS
var Widget = new Class({
  
  Implements: Loop,
  
  initialize: function(log){
    this.setLoop(this.update, 1000);
    this.log = document.id(log);
  },
  
  update: function(count){
    this.log.set('text',"Looped " + count + " times");
  }
  
});

var myWidget = new Widget('log').startLoop();

View the MooDoc for usage and examples.

Change Log

  • 2009-01-01 - setLoop now starts the loop again if it was already looping when setLoop was called.