MCPcopy
hub / github.com/jabbany/CommentCoreLibrary / start

Method start

src/scripting/api/Runtime/Timer.ts:166–186  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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) {

Callers

nothing calls this directly

Calls 2

dispatchEventMethod · 0.65
stopMethod · 0.65

Tested by

no test coverage detected