Subversion Repositories HomeAutomation

Rev

Rev 1036 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 1036 Rev 1042
Line 14... Line 14...
14
 
14
 
15
Interval.triggerIntervalCallback = function(id)
15
Interval.triggerIntervalCallback = function(id)
16
{
16
{
17
    if (Interval.myIntervals[id])
17
    if (Interval.myIntervals[id])
18
    {
18
    {
-
 
19
        //log("Interval:" + id + "> Triggered!\n");
19
        Interval.myIntervals[id].triggerCallback();
20
        Interval.myIntervals[id].triggerCallback();
20
    }
21
    }
21
    else
22
    else
22
    {
23
    {
23
        log("Interval:" + id + "> Encountered a thread that have no javascript Interval object. This is not supposed to be possible, will try to remove this thread also.\n");
24
        log("Interval:" + id + "> Encountered a thread that have no javascript Interval object. This is not supposed to be possible, will try to remove this thread also.\n");
24
       
25
       
25
        if (!stopIntervalThread(id))
26
        if (!stopIntervalThread(id))
26
        {
27
        {
27
            log("Interval:" + this.myId + "> Interval thread seems to have already been stopped.\n");
28
            log("Interval:" + id + "> Interval thread seems to have already been stopped.\n");
28
        }
29
        }
29
    }
30
    }
30
}
31
}
31
 
32
 
32
Interval.prototype.triggerCallback = function()
33
Interval.prototype.triggerCallback = function()
Line 34... Line 35...
34
    this.myCallback();
35
    this.myCallback();
35
}
36
}
36
 
37
 
37
Interval.prototype.setTimeout = function(timeout)
38
Interval.prototype.setTimeout = function(timeout)
38
{
39
{
39
    var isRunning = this.myIsRunning;
-
 
40
    if (isRunning)
40
    if (this.myTimeout != timeout)
41
    {
41
    {
42
        this.stop();
42
        this.myTimeout = timeout;
-
 
43
        setIntervalThreadTimeout(this.myId, timeout);
-
 
44
    }
43
    }
45
}
44
 
46
 
45
    this.myTimeout = timeout;
47
Interval.prototype.reset = function()
46
   
-
 
47
    if (isRunning)
-
 
48
    {
48
{
49
        this.start();
49
    setIntervalThreadTimeout(this.myId, this.myTimeout);
50
    }
-
 
51
}
50
}
52
 
51
 
53
Interval.prototype.setCallback = function(callback)
52
Interval.prototype.setCallback = function(callback)
54
{
53
{
55
    this.myCallback = callback;
54
    this.myCallback = callback;