MCPcopy Create free account
hub / github.com/melonjs/melonJS / updateTimers

Method updateTimers

packages/melonjs/src/system/timer.ts:280–295  ·  view source on GitHub ↗

* update timers * @ignore

()

Source from the content-addressed store, hash-verified

278 * @ignore
279 */
280 updateTimers() {
281 for (const timer of this.timers) {
282 if (!(timer.pauseable && state.isPaused())) {
283 timer.elapsed += this.delta;
284 }
285 if (timer.elapsed >= timer.delay) {
286 timer.fn(...timer.args);
287
288 if (timer.repeat) {
289 timer.elapsed -= timer.delay;
290 } else {
291 this.clearTimer(timer.timerId);
292 }
293 }
294 }
295 }
296}
297
298const timer = new Timer();

Callers 1

updateMethod · 0.95

Calls 1

clearTimerMethod · 0.95

Tested by

no test coverage detected