()
| 164 | } |
| 165 | |
| 166 | public start():void { |
| 167 | if (!this.isRunning) { |
| 168 | var lastTime = Date.now(); |
| 169 | var self = this; |
| 170 | this._timer = setInterval( () => { |
| 171 | var elapsed = Date.now() - lastTime; |
| 172 | self._microtime += elapsed; |
| 173 | if (self._microtime > self._delay) { |
| 174 | self._microtime -= self._delay; |
| 175 | self.currentCount++; |
| 176 | self.dispatchEvent('timer'); |
| 177 | } |
| 178 | lastTime = Date.now(); |
| 179 | if (self._repeatCount > 0 && |
| 180 | self._repeatCount <= self.currentCount) { |
| 181 | self.stop(); |
| 182 | self.dispatchEvent('timerComplete'); |
| 183 | } |
| 184 | }, 20); |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | public stop():void { |
| 189 | if (this.isRunning) { |
nothing calls this directly
no test coverage detected