Class: Thread
Rather complex timer object for the rather lazy.
Implements
Thread Method: constructor
Syntax
var thread = new Thread( options );
Arguments
- options - (object) An object with the options for the Thread.
Options
- fps - (number, defaults to 31) The frames per second for the Thread.
- expires - (number, defaults to -1) How often the thread will be updated before it expires. -1 = infinite
- instant - (boolean, defaults to true) Determines if the thread will be started instantly.
Events
- exec - (function) The function to execute when the thread updates.
- expire - (function)The function to execute when the threads expires.
- beforeexpire - (function) The function to execute just before the thread expires.
- destroy - (function) The function to execute when the thread is destroyed (ie. for thread that never expire).
Returns
- (object) - this (Thread instance)
Thread Method: start
Call to start your thread. Not neccessary if options.instant is set to true.
Syntax
thread.start();
Returns
- (object) - this (Thread instance)
Thread Method: stop
Will stop (pause) the thread. Can be resumed with Thread.start.
Syntax
thread.stop();
Returns
- (object) - this (Thread instance)
Notes
Using this is not mandatory as you can simply use any other mean of redrawing the canvas at a given interval.