Subversion Repositories wimsdev

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
20 reyssat 1
/*
2
        DynAPI Distribution
3
        TimerX Class by Raymond Irving (http://dyntools.shorturl.com)
4
 
5
        The DynAPI Distribution is distributed under the terms of the GNU LGPL license.
6
 
7
        requires: Dynlayer
8
*/
9
 
10
TimerX = {}; // used by dynapi.library
11
 
12
DynLayer.prototype.startTimer=function(interval) {
13
        if (this.tickTimer>0) this.stopTimer()
14
        this._timerInterval=interval||5
15
        this._timerTickCount=0
16
        this._timerStoped=false
17
        this._tickTimer=setTimeout(this+'.tickLoop()',this._timerInterval)
18
}
19
DynLayer.prototype.tickLoop=function() {
20
        if (this._timerStoped==true||this._timerStoped==null) return
21
        this._timerTickCount++;
22
        this.invokeEvent("timer")
23
        this._tickTimer=window.setTimeout(this+'.tickLoop()',this._timerInterval)
24
}
25
DynLayer.prototype.stopTimer=function() {
26
        this._timerStoped=true
27
        clearTimeout(this._tickTimer)
28
        status="stop"
29
}
30
DynLayer.prototype.setTimerInterval=function(interval) {
31
        this._timerInterval=interval||this._timerInterval
32
}
33
DynLayer.prototype.getTimerInterval=function() {
34
        return this._timerInterval
35
}
36
DynLayer.prototype.getTickCount=function() {
37
        return this._timerTickCount
38
}
39
DynLayer.prototype.resetTickCount=function() {
40
        this._timerTickCount=0
41
}
42
 
43
 
44