Source for file ATimer.php
Documentation is available at ATimer.php
* File for ATimer class - the Alia Javascript Timer
* @author Jordan CM Wambaugh <jordan@wambaugh.org>
* ATimer is a javascript timer for Alia applications.
* If the timer is set to singleshot, the timer will run once, and once $interval has passed, the timeout signal will be emitted.
* If the timer's singleshot is set to false, the timer will continue to run every $interval milliseconds.
* Note that this is a javascript timer: the timer will not actually start until the data is sent back to the client.
* @author Jordan CM Wambaugh <jordan@wambaugh.org>
* @signal timeout Emitted every time the timer times out (every interval)
* Milliseconds till timeout is emitted
* Whether the timer is singleshot or not.
* singleshot timers only run once.
* If this is set to false, the timer will continue to emit the timeout signal continuosly every $interval number of milliseconds.
* Whether the timer is currently running
public function __construct($interval=
null,$singleshot =
false){
//define our timer variable in javascript
* sets the intervals between timeouts (in milliseconds)
* @param unknown_type $interval
public function setInterval($interval){
* Sets whether the timer should repeat or just run once.
* @param bool $val true if only runs once, false to run repeatedly
public function setSingleShot($val){
Alia::sendJScript('clearTimeout('.
$this->getObjectID().
"Timer.timer);");
throw new Exception("Cannot start timer with null or 0 interval.");
Alia::sendJScript($this->getObjectID().
"Timer.timer = setTimeout(\"".
AJScript::emit('timeout',$this).
"\",{
$this->interval});
");
Documentation generated on Fri, 11 Jul 2008 13:28:43 -0400 by phpDocumentor 1.4.2