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

Function pause

packages/melonjs/src/state/state.ts:332–348  ·  view source on GitHub ↗

* pause the current stage * @param [music=false] - pause current music track on screen pause

(music: boolean = false)

Source from the content-addressed store, hash-verified

330 * @param [music=false] - pause current music track on screen pause
331 */
332 pause(music: boolean = false): void {
333 // only pause when we are not loading stuff
334 if (_state !== this.LOADING && !this.isPaused()) {
335 // stop the main loop
336 _pauseRunLoop();
337 // current music stop
338 if (music) {
339 pauseTrack();
340 }
341
342 // store time when paused
343 _pauseTime = globalThis.performance.now();
344
345 // publish the pause event
346 emit(STATE_PAUSE);
347 }
348 },
349
350 /**
351 * Restart the current stage from a full stop.

Callers

nothing calls this directly

Calls 3

pauseTrackFunction · 0.90
emitFunction · 0.90
_pauseRunLoopFunction · 0.85

Tested by

no test coverage detected