Class Index | File Index

Classes


Class Timer

The Timer object is used for OOP friendly timer events. This timer's main advantage is in maintaining the context of the object. If this is not a requirement, it is recommended to use the standard javascript timer methods instead.
Note: Timer events will execute in the context of the parent object specified in the constructor.
Defined in: <class.timer.js>.

Class Summary
Constructor Attributes Constructor Name and Description
 
Timer(Parent)
Construct a new Timer object.
Method Summary
Method Attributes Method Name and Description
 
clearInterval(Reference)
Clears/Aborts the timer event.
 
clearTimeout(Reference)
Clears/Aborts the timer event.
 
setInterval(Callback, msec, Arguments)
Register recurring timer event.
 
setTimeout(Callback, msec, Arguments)
Register timer event that will only be called once.
Class Detail
Timer(Parent)
Construct a new Timer object.
Parameters:
Parent
[Optional] The constructor should be called with the parent object. This is optional, and defaults to 'window' object.
Method Detail
clearInterval(Reference)
Clears/Aborts the timer event. IMPORTANT: Do not call clearInterval with the same reference object twice. Always set the reference object to NULL after this call.
Parameters:
Reference
The clearInterval method should be called with the return value from setInterval.
See:
Timer#setInterval

clearTimeout(Reference)
Clears/Aborts the timer event. IMPORTANT: Do not call clearTimeout with the same reference object twice. Always set the reference object to NULL after this call.
Parameters:
Reference
The clearTimeout method should be called with the return value from setTimeout.
See:
Timer#setTimeout

setInterval(Callback, msec, Arguments)
Register recurring timer event.
function MyTest()
{
	var mytimer = new Timer(this);
	this.TimerEvent = function() { alert('Timer event'); }
	this.Start = function() { mytimer.setInterval('TimerEvent', 5000); }
}
Parameters:
{String} Callback
The name of the "callback" object method (as string).
{Int} msec
Interval specified in milliseconds.
Arguments
[Optional] Any number of extra arguments, which will all be passed to the method when it is evaluated.
Returns:
Returns a reference that can be used to clear/abort the timer event.
See:
Timer#clearInterval
Timer#setTimeout

setTimeout(Callback, msec, Arguments)
Register timer event that will only be called once.
function MyTest()
{
	var mytimer = new Timer(this);
	this.TimerEvent = function() { alert('Timer event'); }
	this.Start = function() { mytimer.setTimeout('TimerEvent', 5000); }
}
Parameters:
{String} Callback
The name of the "callback" object method (as string).
{Int} msec
Interval specified in milliseconds.
Arguments
[Optional] Any number of extra arguments, which will all be passed to the method when it is evaluated.
Returns:
Returns a reference that can be used to clear/abort the timer event.
See:
Timer#clearTimeout
Timer#setInterval

©2008 - Spacial Audio Solutions, LLC
Documentation generated by JsDoc Toolkit 2.0.2 on Mon Apr 20 2009 17:57:05 GMT+0200 (SAST)