* Stop the current stage. * @param [shouldPauseTrack=false] - pause current track on screen stop.
(shouldPauseTrack: boolean = false)
| 305 | * @param [shouldPauseTrack=false] - pause current track on screen stop. |
| 306 | */ |
| 307 | stop(shouldPauseTrack: boolean = false): void { |
| 308 | // only stop when we are not loading stuff |
| 309 | if (_state !== this.LOADING && this.isRunning()) { |
| 310 | // caller is taking over — drop any in-flight freeze |
| 311 | _cancelFreeze(); |
| 312 | // stop the main loop |
| 313 | _stopRunLoop(); |
| 314 | |
| 315 | // current music stop |
| 316 | if (shouldPauseTrack) { |
| 317 | pauseTrack(); |
| 318 | } |
| 319 | |
| 320 | // store time when stopped |
| 321 | _pauseTime = globalThis.performance.now(); |
| 322 | |
| 323 | // publish the stop notification |
| 324 | emit(STATE_STOP); |
| 325 | } |
| 326 | }, |
| 327 | |
| 328 | /** |
| 329 | * pause the current stage |
nothing calls this directly
no test coverage detected