Rev 971 | Rev 974 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 971 | Rev 973 | ||
|---|---|---|---|
| Line 19... | Line 19... | ||
| 19 | Interval.myIntervals[id].triggerCallback(); |
19 | Interval.myIntervals[id].triggerCallback(); |
| 20 | } |
20 | } |
| 21 | else |
21 | else |
| 22 | { |
22 | { |
| 23 | log("Interval:" + id + "> Encountered a thread that have no javascript Interval object. This is not supposed to be possible, report this.\n"); |
23 | log("Interval:" + id + "> Encountered a thread that have no javascript Interval object. This is not supposed to be possible, report this.\n"); |
| - | 24 | ||
| 24 |
|
25 | if (!stopIntervalThread(id)) |
| - | 26 | { |
|
| - | 27 | log("Interval:" + id + "> Interval thread could not be stopped.\n"); |
|
| - | 28 | } |
|
| 25 | } |
29 | } |
| 26 | } |
30 | } |
| 27 | 31 | ||
| 28 | Interval.prototype.triggerCallback = function() |
32 | Interval.prototype.triggerCallback = function() |
| 29 | { |
33 | { |
| 30 | this.myCallback(); |
34 | this.myCallback(); |
| 31 | } |
35 | } |
| 32 | 36 | ||
| 33 | Interval.prototype.setTimeout = function(timeout) |
37 | Interval.prototype.setTimeout = function(timeout) |
| 34 | { |
38 | { |
| 35 | var isRunning = this.myIsRunning; |
39 | var isRunning = this.myIsRunning; |
| 36 | if (isRunning) |
40 | if (isRunning) |
| 37 | { |
41 | { |
| 38 | this.stop(); |
42 | this.stop(); |
| 39 | } |
43 | } |
| 40 | 44 | ||
| 41 | this.myTimeout = timeout; |
45 | this.myTimeout = timeout; |
| 42 | 46 | ||
| 43 | if (isRunning) |
47 | if (isRunning) |
| 44 | { |
48 | { |
| 45 | this.start(); |
49 | this.start(); |
| 46 | } |
50 | } |
| 47 | } |
51 | } |
| 48 | 52 | ||
| 49 | Interval.prototype.setCallback = function(callback) |
53 | Interval.prototype.setCallback = function(callback) |
| Line 54... | Line 58... | ||
| 54 | Interval.prototype.start = function() |
58 | Interval.prototype.start = function() |
| 55 | { |
59 | { |
| 56 | this.myIsRunning = true; |
60 | this.myIsRunning = true; |
| 57 | this.myId = startIntervalThread(this.myTimeout) |
61 | this.myId = startIntervalThread(this.myTimeout) |
| 58 | Interval.myIntervals[this.myId] = this; |
62 | Interval.myIntervals[this.myId] = this; |
| 59 | } |
63 | } |
| 60 | 64 | ||
| 61 | Interval.prototype.stop = function() |
65 | Interval.prototype.stop = function() |
| 62 | { |
66 | { |
| 63 | this.myIsRunning = false; |
67 | this.myIsRunning = false; |
| - | 68 | ||
| 64 |
|
69 | if (!stopIntervalThread(this.myId)) |
| - | 70 | { |
|
| - | 71 | log("Interval:" + this.myId + "> Interval thread could not be stopped.\n"); |
|
| - | 72 | } |
|
| - | 73 | ||
| 65 | delete Interval.myIntervals[this.myId]; |
74 | delete Interval.myIntervals[this.myId]; |
| 66 | this.myId = null; |
75 | this.myId = null; |
| 67 | } |
76 | } |