home *** CD-ROM | disk | FTP | other *** search
- class ds.controls.Timer
- {
- var func;
- var interval;
- var m_timerId = -1;
- function Timer(f, i)
- {
- if(f)
- {
- this.func = f;
- }
- if(i)
- {
- this.interval = i;
- }
- this.m_timerId = -1;
- }
- function start(_func, _interval)
- {
- if(this.m_timerId != -1)
- {
- this.stop();
- }
- if(_func && this.func != _func)
- {
- this.func = _func;
- }
- if(_interval && this.interval != _interval)
- {
- this.interval = _interval;
- }
- this.m_timerId = setInterval(this.func,this.interval);
- }
- function stop()
- {
- clearInterval(this.m_timerId);
- this.m_timerId = -1;
- }
- function isRunning()
- {
- return this.m_timerId != -1;
- }
- }
-