@remvst/game-navigation-core 2.0.1 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/lib/game/frame-timing.d.ts +16 -0
- package/lib/game/frame-timing.js +2 -0
- package/lib/game/frame-timing.js.map +1 -0
- package/lib/game/game-plugin.d.ts +1 -0
- package/lib/game/game-plugin.js +1 -0
- package/lib/game/game-plugin.js.map +1 -1
- package/lib/game/game.d.ts +3 -0
- package/lib/game/game.js +40 -1
- package/lib/game/game.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/interaction/inputs.d.ts +2 -0
- package/lib/interaction/inputs.js +16 -1
- package/lib/interaction/inputs.js.map +1 -1
- package/lib/plugins/automation-game-plugin.d.ts +1 -0
- package/lib/plugins/automation-game-plugin.js +4 -0
- package/lib/plugins/automation-game-plugin.js.map +1 -1
- package/lib/plugins/back-navigation-plugin.d.ts +2 -0
- package/lib/plugins/back-navigation-plugin.js +13 -1
- package/lib/plugins/back-navigation-plugin.js.map +1 -1
- package/lib/plugins/blur-pausing-game-plugin.d.ts +2 -0
- package/lib/plugins/blur-pausing-game-plugin.js +15 -2
- package/lib/plugins/blur-pausing-game-plugin.js.map +1 -1
- package/lib/plugins/dom-debugger-game-plugin.d.ts +1 -0
- package/lib/plugins/dom-debugger-game-plugin.js +4 -0
- package/lib/plugins/dom-debugger-game-plugin.js.map +1 -1
- package/lib/plugins/fullscreen-button-game-plugin.d.ts +2 -0
- package/lib/plugins/fullscreen-button-game-plugin.js +28 -7
- package/lib/plugins/fullscreen-button-game-plugin.js.map +1 -1
- package/lib/plugins/metrics-game-plugin.d.ts +2 -0
- package/lib/plugins/metrics-game-plugin.js +24 -8
- package/lib/plugins/metrics-game-plugin.js.map +1 -1
- package/lib/plugins/version-label-game-plugin.d.ts +1 -0
- package/lib/plugins/version-label-game-plugin.js +5 -0
- package/lib/plugins/version-label-game-plugin.js.map +1 -1
- package/package.json +3 -3
- package/src/game/frame-timing.ts +17 -0
- package/src/game/game-plugin.ts +1 -0
- package/src/game/game.ts +46 -4
- package/src/index.ts +1 -0
- package/src/interaction/inputs.ts +12 -1
- package/src/plugins/automation-game-plugin.ts +5 -0
- package/src/plugins/back-navigation-plugin.ts +8 -1
- package/src/plugins/blur-pausing-game-plugin.ts +11 -2
- package/src/plugins/dom-debugger-game-plugin.ts +5 -0
- package/src/plugins/fullscreen-button-game-plugin.ts +16 -7
- package/src/plugins/metrics-game-plugin.ts +36 -23
- package/src/plugins/version-label-game-plugin.ts +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# @remvst/game-navigation-core
|
|
2
2
|
|
|
3
|
+
## 5.0.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- cfdee58: Add a way to destroy a game, plugins, and inputs
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [cfdee58]
|
|
12
|
+
- @remvst/client-inputs@1.2.0
|
|
13
|
+
|
|
14
|
+
## 3.0.0
|
|
15
|
+
|
|
16
|
+
### Minor Changes
|
|
17
|
+
|
|
18
|
+
- 045c062: Add an opt-in per-frame phase timer. Set `Game.onFrameTiming` to receive a
|
|
19
|
+
`FrameTiming` each frame — whole frame vs cycle phase vs render/draw phase,
|
|
20
|
+
plus the `otherMs` remainder. The loop owns the phases, so it produces the
|
|
21
|
+
split natively instead of a game reconstructing it from plugin hooks. Null by
|
|
22
|
+
default, in which case the per-frame timing is simply discarded.
|
|
23
|
+
|
|
24
|
+
The finer model-vs-render-update split within `cycle()` still has to be timed
|
|
25
|
+
by the game at its own screen-level seam.
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- Updated dependencies [3bfd18b]
|
|
30
|
+
- @remvst/optimization@1.10.0
|
|
31
|
+
|
|
3
32
|
## 2.0.1
|
|
4
33
|
|
|
5
34
|
### Patch Changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface FrameTiming {
|
|
2
|
+
/** Whole-frame main-thread time, in ms. */
|
|
3
|
+
frameMs: number;
|
|
4
|
+
/**
|
|
5
|
+
* Time in the cycle phase, in ms. This covers the whole simulation plus any
|
|
6
|
+
* view-controller updates that run inside a screen's `cycle()`. The finer
|
|
7
|
+
* model-vs-render-update split within a frame has to be timed by the game
|
|
8
|
+
* at its own screen-level seam.
|
|
9
|
+
*/
|
|
10
|
+
cycleMs: number;
|
|
11
|
+
/** Time in the render/draw phase, in ms. */
|
|
12
|
+
drawMs: number;
|
|
13
|
+
/** `frameMs − cycleMs − drawMs` — plugin hooks, input, GC, browser. */
|
|
14
|
+
otherMs: number;
|
|
15
|
+
}
|
|
16
|
+
export type FrameTimingObserver = (timing: FrameTiming) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frame-timing.js","sourceRoot":"","sources":["../../src/game/frame-timing.ts"],"names":[],"mappings":""}
|
package/lib/game/game-plugin.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"game-plugin.js","sourceRoot":"","sources":["../../src/game/game-plugin.ts"],"names":[],"mappings":"AAGA,MAAM,OAAgB,UAAU;IAK5B,IAAI,UAAU;QACV,OAAO,CAAC,CAAC;IACb,CAAC;IAED,IAAI,CAAC,IAAU;QACX,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;IAED,KAAK,KAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"game-plugin.js","sourceRoot":"","sources":["../../src/game/game-plugin.ts"],"names":[],"mappings":"AAGA,MAAM,OAAgB,UAAU;IAK5B,IAAI,UAAU;QACV,OAAO,CAAC,CAAC;IACb,CAAC;IAED,IAAI,CAAC,IAAU;QACX,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;IAED,KAAK,KAAU,CAAC;IAChB,OAAO,KAAU,CAAC;IAElB,WAAW,CAAC,MAAc,IAAS,CAAC;IACpC,sBAAsB,CAAC,MAAqB,IAAS,CAAC;IAEtD,KAAK,CAAC,OAAe,IAAG,CAAC;IAEzB,YAAY,KAAI,CAAC;IACjB,UAAU,KAAI,CAAC;IAEf,aAAa,KAAI,CAAC;IAClB,WAAW,KAAI,CAAC;IAEhB,MAAM,KAAI,CAAC;IAEX,YAAY,KAAI,CAAC;IACjB,UAAU,KAAI,CAAC;IAEf,cAAc,CAAC,MAA8B,IAAG,CAAC;CACpD"}
|
package/lib/game/game.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { GameInputs } from "../interaction/inputs";
|
|
2
2
|
import { ScreenStack } from "../navigation/screen-stack";
|
|
3
|
+
import { FrameTimingObserver } from "./frame-timing";
|
|
3
4
|
import { GameParams } from "./game-params";
|
|
4
5
|
import { GamePlugin } from "./game-plugin";
|
|
5
6
|
export declare abstract class Game<ParamsType extends GameParams = GameParams> {
|
|
@@ -11,6 +12,7 @@ export declare abstract class Game<ParamsType extends GameParams = GameParams> {
|
|
|
11
12
|
private lastFrame;
|
|
12
13
|
private animationFrameId;
|
|
13
14
|
private runningLoop;
|
|
15
|
+
onFrameTiming: FrameTimingObserver | null;
|
|
14
16
|
constructor(params: ParamsType);
|
|
15
17
|
abstract get plugins(): GamePlugin[];
|
|
16
18
|
abstract get container(): HTMLElement;
|
|
@@ -18,6 +20,7 @@ export declare abstract class Game<ParamsType extends GameParams = GameParams> {
|
|
|
18
20
|
key: string;
|
|
19
21
|
}): T;
|
|
20
22
|
setup(): void;
|
|
23
|
+
destroy(): void;
|
|
21
24
|
scheduleFrame(): void;
|
|
22
25
|
stopLoop(): void;
|
|
23
26
|
frame(): void;
|
package/lib/game/game.js
CHANGED
|
@@ -7,6 +7,7 @@ export class Game {
|
|
|
7
7
|
// Time
|
|
8
8
|
this.age = 0;
|
|
9
9
|
this.runningLoop = false;
|
|
10
|
+
this.onFrameTiming = null;
|
|
10
11
|
this.parseURL();
|
|
11
12
|
}
|
|
12
13
|
plugin(keyProvider) {
|
|
@@ -25,13 +26,36 @@ export class Game {
|
|
|
25
26
|
plugin.setup();
|
|
26
27
|
}
|
|
27
28
|
catch (err) {
|
|
28
|
-
console.error(`Failed to setup ${plugin.key} plugin
|
|
29
|
+
console.error(`Failed to setup ${plugin.key} plugin`, err);
|
|
29
30
|
throw err;
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
this.lastFrame = window.performance.now();
|
|
33
34
|
this.scheduleFrame();
|
|
34
35
|
}
|
|
36
|
+
destroy() {
|
|
37
|
+
this.stopLoop();
|
|
38
|
+
const errors = [];
|
|
39
|
+
try {
|
|
40
|
+
this.inputs.destroy();
|
|
41
|
+
}
|
|
42
|
+
catch (err) {
|
|
43
|
+
console.error(`Failed to destroy inputs`, err);
|
|
44
|
+
errors.push(err);
|
|
45
|
+
}
|
|
46
|
+
for (const plugin of this.plugins) {
|
|
47
|
+
try {
|
|
48
|
+
plugin.destroy();
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
console.error(`Failed to destroy ${plugin.key} plugin`, err);
|
|
52
|
+
errors.push(err);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (errors.length > 0) {
|
|
56
|
+
throw errors[0];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
35
59
|
scheduleFrame() {
|
|
36
60
|
if (this.animationFrameId) {
|
|
37
61
|
return;
|
|
@@ -54,6 +78,8 @@ export class Game {
|
|
|
54
78
|
this.animationFrameId = null;
|
|
55
79
|
}
|
|
56
80
|
frame() {
|
|
81
|
+
var _a;
|
|
82
|
+
const frameStart = window.performance.now();
|
|
57
83
|
for (const plugin of this.plugins)
|
|
58
84
|
plugin.onFrameStart();
|
|
59
85
|
const now = window.performance.now();
|
|
@@ -62,17 +88,30 @@ export class Game {
|
|
|
62
88
|
this.lastFrame = now;
|
|
63
89
|
for (const plugin of this.plugins)
|
|
64
90
|
plugin.onCycleStart();
|
|
91
|
+
const cycleStart = window.performance.now();
|
|
65
92
|
this.cycle(elapsed);
|
|
93
|
+
const cycleEnd = window.performance.now();
|
|
66
94
|
for (const plugin of this.plugins)
|
|
67
95
|
plugin.onCycleEnd();
|
|
68
96
|
for (const plugin of this.plugins)
|
|
69
97
|
plugin.onRenderStart();
|
|
98
|
+
const drawStart = window.performance.now();
|
|
70
99
|
for (const plugin of this.plugins)
|
|
71
100
|
plugin.render();
|
|
101
|
+
const drawEnd = window.performance.now();
|
|
72
102
|
for (const plugin of this.plugins)
|
|
73
103
|
plugin.onRenderEnd();
|
|
74
104
|
for (const plugin of this.plugins)
|
|
75
105
|
plugin.onFrameEnd();
|
|
106
|
+
const frameMs = window.performance.now() - frameStart;
|
|
107
|
+
const cycleMs = cycleEnd - cycleStart;
|
|
108
|
+
const drawMs = drawEnd - drawStart;
|
|
109
|
+
(_a = this.onFrameTiming) === null || _a === void 0 ? void 0 : _a.call(this, {
|
|
110
|
+
frameMs,
|
|
111
|
+
cycleMs,
|
|
112
|
+
drawMs,
|
|
113
|
+
otherMs: frameMs - cycleMs - drawMs,
|
|
114
|
+
});
|
|
76
115
|
if (this.runningLoop) {
|
|
77
116
|
this.scheduleFrame();
|
|
78
117
|
}
|
package/lib/game/game.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"game.js","sourceRoot":"","sources":["../../src/game/game.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"game.js","sourceRoot":"","sources":["../../src/game/game.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAKzD,MAAM,OAAgB,IAAI;IAmBtB,YAA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C,KAAK,CAAC,EAAE,CAAC;gBAC9B,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC;YACvC,CAAC;YAEA,IAAI,CAAC,MAAc,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;QACxC,CAAC;IACL,CAAC;IAED,sBAAsB;QAClB,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;QAC1C,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,UAAU,CAAC;QAEjD,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YAChC,MAAM,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAC;QAC1C,CAAC;IACL,CAAC;CACJ"}
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mCAAmC,CAAC;AAElD,cAAc,uCAAuC,CAAC;AACtD,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAE1C,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AAErC,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC;AACnD,cAAc,yCAAyC,CAAC;AACxD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AAEpD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAE3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oBAAoB,CAAC;AACnC,cAAc,qCAAqC,CAAC;AAEpD,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mCAAmC,CAAC;AAElD,cAAc,uCAAuC,CAAC;AACtD,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAE1C,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AAErC,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC;AACnD,cAAc,yCAAyC,CAAC;AACxD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AAEpD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAE3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oBAAoB,CAAC;AACnC,cAAc,qCAAqC,CAAC;AAEpD,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC"}
|
|
@@ -15,12 +15,14 @@ export declare class ScreenInputs implements Inputs {
|
|
|
15
15
|
import(other: Inputs): void;
|
|
16
16
|
}
|
|
17
17
|
export declare class GameInputs implements Inputs {
|
|
18
|
+
#private;
|
|
18
19
|
private readonly game;
|
|
19
20
|
readonly keyboard: DOMKeyboardInputs;
|
|
20
21
|
readonly mouse: DOMMouseInputs;
|
|
21
22
|
readonly gamepad: DOMGamepadInputs;
|
|
22
23
|
constructor(game: Game);
|
|
23
24
|
setup(): void;
|
|
25
|
+
destroy(): void;
|
|
24
26
|
reset(): void;
|
|
25
27
|
private makeGamepadInactive;
|
|
26
28
|
private loopScreens;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
+
};
|
|
6
|
+
var _GameInputs_blurListener;
|
|
1
7
|
import { DOMGamepadInputs, DOMKeyboardInputs, DOMMouseInputs, } from "@remvst/client-inputs";
|
|
2
8
|
import GamepadInputs from "@remvst/client-inputs/lib/gamepad/gamepad-inputs";
|
|
3
9
|
import KeyboardInputs from "@remvst/client-inputs/lib/keyboard/keyboard-inputs";
|
|
@@ -32,6 +38,7 @@ export class GameInputs {
|
|
|
32
38
|
this.keyboard = new DOMKeyboardInputs();
|
|
33
39
|
this.mouse = new DOMMouseInputs(this.game.container, this.game.params);
|
|
34
40
|
this.gamepad = new DOMGamepadInputs();
|
|
41
|
+
_GameInputs_blurListener.set(this, () => this.reset());
|
|
35
42
|
this.keyboard.onKeyDown = (keyCode) => {
|
|
36
43
|
this.makeGamepadInactive();
|
|
37
44
|
this.loopScreens((inputs) => inputs.keyboard.setDown(keyCode, true));
|
|
@@ -66,7 +73,14 @@ export class GameInputs {
|
|
|
66
73
|
this.keyboard.setup();
|
|
67
74
|
this.mouse.setup();
|
|
68
75
|
this.gamepad.setup();
|
|
69
|
-
window.addEventListener("blur", (
|
|
76
|
+
window.addEventListener("blur", __classPrivateFieldGet(this, _GameInputs_blurListener, "f"), false);
|
|
77
|
+
}
|
|
78
|
+
destroy() {
|
|
79
|
+
window.removeEventListener("blur", __classPrivateFieldGet(this, _GameInputs_blurListener, "f"), false);
|
|
80
|
+
this.reset();
|
|
81
|
+
this.keyboard.destroy();
|
|
82
|
+
this.mouse.destroy();
|
|
83
|
+
this.gamepad.destroy();
|
|
70
84
|
}
|
|
71
85
|
reset() {
|
|
72
86
|
this.keyboard.reset();
|
|
@@ -95,4 +109,5 @@ export class GameInputs {
|
|
|
95
109
|
this.keyboard.preventDefault();
|
|
96
110
|
}
|
|
97
111
|
}
|
|
112
|
+
_GameInputs_blurListener = new WeakMap();
|
|
98
113
|
//# sourceMappingURL=inputs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputs.js","sourceRoot":"","sources":["../../src/interaction/inputs.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,GAEjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,aAAa,MAAM,kDAAkD,CAAC;AAC7E,OAAO,cAAc,MAAM,oDAAoD,CAAC;AAGhF,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,MAAM,OAAO,YAAY;IAKrB,YAAqB,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;QAJ1B,aAAQ,GAAG,IAAI,cAAc,EAAE,CAAC;QAChC,UAAK,GAAG,IAAI,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACvD,YAAO,GAAG,IAAI,aAAa,EAAE,CAAC;IAED,CAAC;IAEvC,KAAK;QACD,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QACtB,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACnB,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC;IAED,KAAK;QACD,IAAI,CAAC,QAAQ,CAAC,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
14
14
|
this.automationLabel.id = "automation-label";
|
|
15
15
|
document.body.appendChild(this.automationLabel);
|
|
16
16
|
}
|
|
17
|
+
destroy() {
|
|
18
|
+
super.destroy();
|
|
19
|
+
this.automationLabel.remove();
|
|
20
|
+
}
|
|
17
21
|
render() {
|
|
18
22
|
super.render();
|
|
19
23
|
const automation = {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"automation-game-plugin.js","sourceRoot":"","sources":["../../src/plugins/automation-game-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,MAAM,OAAO,oBAAqB,SAAQ,UAAU;IAOhD,IAAI,UAAU;QACV,OAAO,IAAI,CAAC,oBAAoB,CAAC;IACrC,CAAC;IAED,YAA6B,oBAAoB,GAAG,CAAC;QACjD,KAAK,EAAE,CAAC;QADiB,yBAAoB,GAApB,oBAAoB,CAAI;QAT5C,QAAG,GAAG,oBAAoB,CAAC,GAAG,CAAC;IAWxC,CAAC;IAED,KAAK;QACD,KAAK,CAAC,KAAK,EAAE,CAAC;QAEd,IAAI,CAAC,eAAe,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QACrD,IAAI,CAAC,eAAe,CAAC,EAAE,GAAG,kBAAkB,CAAC;QAC7C,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IACpD,CAAC;IAED,MAAM;QACF,KAAK,CAAC,MAAM,EAAE,CAAC;QAEf,MAAM,UAAU,GAAG,EAAE,CAAC;QACtB,IAAI,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;QACrC,IAAI,CAAC,eAAe,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QAE5D,4CAA4C;QAC5C,MAAM,YAAY,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QACrD,YAAY,CAAC,YAAY,CAAC,IA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AC,CAAC;QAE5D,4CAA4C;QAC5C,MAAM,YAAY,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QACrD,YAAY,CAAC,YAAY,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QAC7C,YAAY,CAAC,SAAS;YAClB,mFAAmF,CAAC;QACxF,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;IAC5C,CAAC;IAED,mBAAmB,CAAC,GAA2B;QAC3C,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;IAClC,CAAC;CACJ;AA7CmB,wBAAG,GAAG,YAAY,AAAf,CAAgB"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { GamePlugin } from "../game/game-plugin";
|
|
2
2
|
import { Screen } from "../ui/screen";
|
|
3
3
|
export declare class BackNavigationPlugin extends GamePlugin {
|
|
4
|
+
#private;
|
|
4
5
|
readonly key = "back-navigation";
|
|
5
6
|
private pushedState;
|
|
6
7
|
setup(): void;
|
|
8
|
+
destroy(): void;
|
|
7
9
|
pushState(): void;
|
|
8
10
|
popState(): void;
|
|
9
11
|
private onPopState;
|
|
@@ -1,16 +1,27 @@
|
|
|
1
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
+
};
|
|
6
|
+
var _BackNavigationPlugin_onPopStateListener;
|
|
1
7
|
import { GamePlugin } from "../game/game-plugin";
|
|
2
8
|
export class BackNavigationPlugin extends GamePlugin {
|
|
3
9
|
constructor() {
|
|
4
10
|
super(...arguments);
|
|
5
11
|
this.key = "back-navigation";
|
|
6
12
|
this.pushedState = false;
|
|
13
|
+
_BackNavigationPlugin_onPopStateListener.set(this, () => this.onPopState());
|
|
7
14
|
}
|
|
8
15
|
setup() {
|
|
9
16
|
super.setup();
|
|
10
17
|
const { length } = history;
|
|
11
18
|
if (length > 0)
|
|
12
19
|
history.go(-length);
|
|
13
|
-
window.addEventListener("popstate", (
|
|
20
|
+
window.addEventListener("popstate", __classPrivateFieldGet(this, _BackNavigationPlugin_onPopStateListener, "f"));
|
|
21
|
+
}
|
|
22
|
+
destroy() {
|
|
23
|
+
super.destroy();
|
|
24
|
+
window.removeEventListener("popstate", __classPrivateFieldGet(this, _BackNavigationPlugin_onPopStateListener, "f"));
|
|
14
25
|
}
|
|
15
26
|
pushState() {
|
|
16
27
|
if (this.pushedState)
|
|
@@ -45,4 +56,5 @@ export class BackNavigationPlugin extends GamePlugin {
|
|
|
45
56
|
}
|
|
46
57
|
}
|
|
47
58
|
}
|
|
59
|
+
_BackNavigationPlugin_onPopStateListener = new WeakMap();
|
|
48
60
|
//# sourceMappingURL=back-navigation-plugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"back-navigation-plugin.js","sourceRoot":"","sources":["../../src/plugins/back-navigation-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAIjD,MAAM,OAAO,oBAAqB,SAAQ,UAAU;IAApD;;QACa,QAAG,GAAG,iBAAiB,CAAC;QAEzB,gBAAW,GAAG,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"back-navigation-plugin.js","sourceRoot":"","sources":["../../src/plugins/back-navigation-plugin.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAIjD,MAAM,OAAO,oBAAqB,SAAQ,UAAU;IAApD;;QACa,QAAG,GAAG,iBAAiB,CAAC;QAEzB,gBAAW,GAAG,KAAK,CAAC;QAE5B,mDAAsB,GAAG,EAAE,CAAC,I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,qBAAqB,GACvB,MACH,aADG,MAAM,uBAAN,MAAM,CACP,gBAAgB,CAAC;QACpB,IAAI,qBAAqB,EAAE,CAAC;YACxB,IAAI,CAAC,SAAS,EAAE,CAAC;QACrB,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,QAAQ,EAAE,CAAC;QACpB,CAAC;IACL,CAAC;CACJ"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { GamePlugin } from "../game/game-plugin";
|
|
2
2
|
export declare class BlurPausingGamePlugin extends GamePlugin {
|
|
3
|
+
#private;
|
|
3
4
|
static readonly key = "blur-pausing-game";
|
|
4
5
|
readonly key = "blur-pausing-game";
|
|
5
6
|
private _enabled;
|
|
6
7
|
get enabled(): boolean;
|
|
7
8
|
set enabled(enabled: boolean);
|
|
8
9
|
setup(): void;
|
|
10
|
+
destroy(): void;
|
|
9
11
|
private updateLoop;
|
|
10
12
|
}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
+
};
|
|
6
|
+
var _BlurPausingGamePlugin_updateLoopListener;
|
|
1
7
|
import { GamePlugin } from "../game/game-plugin";
|
|
2
8
|
export class BlurPausingGamePlugin extends GamePlugin {
|
|
3
9
|
constructor() {
|
|
4
10
|
super(...arguments);
|
|
5
11
|
this.key = BlurPausingGamePlugin.key;
|
|
6
12
|
this._enabled = true;
|
|
13
|
+
_BlurPausingGamePlugin_updateLoopListener.set(this, () => this.updateLoop());
|
|
7
14
|
}
|
|
8
15
|
get enabled() {
|
|
9
16
|
return this._enabled;
|
|
@@ -14,8 +21,13 @@ export class BlurPausingGamePlugin extends GamePlugin {
|
|
|
14
21
|
}
|
|
15
22
|
setup() {
|
|
16
23
|
super.setup();
|
|
17
|
-
window.addEventListener("blur", (
|
|
18
|
-
window.addEventListener("focus", (
|
|
24
|
+
window.addEventListener("blur", __classPrivateFieldGet(this, _BlurPausingGamePlugin_updateLoopListener, "f"), false);
|
|
25
|
+
window.addEventListener("focus", __classPrivateFieldGet(this, _BlurPausingGamePlugin_updateLoopListener, "f"), false);
|
|
26
|
+
}
|
|
27
|
+
destroy() {
|
|
28
|
+
super.destroy();
|
|
29
|
+
window.removeEventListener("blur", __classPrivateFieldGet(this, _BlurPausingGamePlugin_updateLoopListener, "f"), false);
|
|
30
|
+
window.removeEventListener("focus", __classPrivateFieldGet(this, _BlurPausingGamePlugin_updateLoopListener, "f"), false);
|
|
19
31
|
}
|
|
20
32
|
updateLoop() {
|
|
21
33
|
if (document.hasFocus() || !this._enabled) {
|
|
@@ -26,5 +38,6 @@ export class BlurPausingGamePlugin extends GamePlugin {
|
|
|
26
38
|
}
|
|
27
39
|
}
|
|
28
40
|
}
|
|
41
|
+
_BlurPausingGamePlugin_updateLoopListener = new WeakMap();
|
|
29
42
|
BlurPausingGamePlugin.key = "blur-pausing-game";
|
|
30
43
|
//# sourceMappingURL=blur-pausing-game-plugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blur-pausing-game-plugin.js","sourceRoot":"","sources":["../../src/plugins/blur-pausing-game-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,MAAM,OAAO,qBAAsB,SAAQ,UAAU;IAArD;;QAEa,QAAG,GAAG,qBAAqB,CAAC,GAAG,CAAC;QAEjC,aAAQ,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"blur-pausing-game-plugin.js","sourceRoot":"","sources":["../../src/plugins/blur-pausing-game-plugin.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EA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amePlugin extends GamePlugin {
|
|
|
44
44
|
super.setup();
|
|
45
45
|
__classPrivateFieldGet(this, _DOMDebuggerGamePlugin_container, "f").appendChild(this.domElement);
|
|
46
46
|
}
|
|
47
|
+
destroy() {
|
|
48
|
+
super.destroy();
|
|
49
|
+
this.domElement.remove();
|
|
50
|
+
}
|
|
47
51
|
cycle(elapsed) {
|
|
48
52
|
super.cycle(elapsed);
|
|
49
53
|
if (!__classPrivateFieldGet(this, _DOMDebuggerGamePlugin_visible, "f"))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom-debugger-game-plugin.js","sourceRoot":"","sources":["../../src/plugins/dom-debugger-game-plugin.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,MAAM,OAAO,qBAAsB,SAAQ,UAAU;IAmBjD,YAAqB,SAAS,GAAgB,QAAQ,CAAC,IAAI;QACvD,KAAK,EAAE,CAAC;QADS,cAAS,GAAT,SAAS,CAA6B;QAjBlD,QAAG,GAAG,qBAAqB,CAAC,GAAG,CAAC;QAEzC,yCAAW,IAAI,EAAC;QACP,mDAAwB;QAExB,eAAU,GAAG,CAAC,GAAG,EAAE;YACxB,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;YAC1C,GAAG,CAAC,SAAS,GAAG,cAAc,CAAC;YAC/B,GAAG,CAAC,KAAK,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChC,GAAG,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,CAAC;YACpB,GAAG,CAAC,KAAK,CAAC,IAAI,GAAG,GAAG,CAAC;YACrB,GAAG,CAAC,KAAK,CAAC,QAAQ,GAAG,MAAM,CAAC;YAC5B,GAAG,CAAC,KAAK,CAAC,KAAK,GAAG,OAAO,CAAC;YAC1B,GAAG,CAAC,KAAK,CAAC,UAAU,GAAG,WAAW,CAAC;YACnC,OAAO,GAAG,CAAC;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CAAC;QAChB,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;IAC7B,CAAC;IAED,KAAK,CAAC,OAAe;QACjB,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAErB,IAAI,CAAC,uBAAA,IAAI,sCAAS;YAAE,OAAO;QAE3B,MAAM,KAAK,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QAChC,IAAI,CAAC,UAAU,CAAC,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;aACzC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,KAAM,KAAa,CAAC,GAAG,CAAC,EAAE,CAAC;aAC9C,IAAI,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;CACJ;;AAvDmB,yBAAG,GAAG,cAAc,AAAjB,CAAkB"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { GamePlugin } from "../game/game-plugin";
|
|
2
2
|
export declare class FullscreenButtonGamePlugin extends GamePlugin {
|
|
3
|
+
#private;
|
|
3
4
|
private readonly container;
|
|
4
5
|
static readonly key = "fullscreen-button";
|
|
5
6
|
readonly key = "fullscreen-button";
|
|
6
7
|
constructor(container: HTMLElement);
|
|
7
8
|
setup(): void;
|
|
9
|
+
destroy(): void;
|
|
8
10
|
}
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _FullscreenButtonGamePlugin_buttonElement, _FullscreenButtonGamePlugin_styleElement;
|
|
1
13
|
import { GamePlugin } from "../game/game-plugin";
|
|
2
14
|
const ICON_DATA = "iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAABhWlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AcxV9bpSIVQYuIOASsulgQFXHUKhShQqgVWnUwufQLmjQkKS6OgmvBwY/FqoOLs64OroIg+AHi6OSk6CIl/i8ptIjx4Lgf7+497t4B/lqJqWbbOKBqlpGMx4R0ZlUIviKEHvRhFEMSM/U5UUzAc3zdw8fXuyjP8j735+hSsiYDfALxLNMNi3iDeHrT0jnvE4dZQVKIz4nHDLog8SPXZZffOOcd9vPMsJFKzhOHiYV8C8stzAqGSjxFHFFUjfL9aZcVzluc1VKFNe7JXxjKaivLXKc5iDgWsQQRAmRUUEQJFqK0aqSYSNJ+zMM/4PhFcsnkKoKRYwFlqJAcP/gf/O7WzE1OuEmhGND+Ytsfw0BwF6hXbfv72LbrJ0DgGbjSmv5yDZj5JL3a1CJHQPc2cHHd1OQ94HIH6H/SJUNypABNfy4HvJ/RN2WA3lugc83trbGP0wcgRV0lboCDQ2AkT9nrHu/uaO3t3zON/n4AqiVyvXIak4gAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAALiMAAC4jAXilP3YAAAAHdElNRQfnAgQQGhZq6KlXAAAAK0lEQVQY02P8////fwYoYGRkZGRAAshyqBwc4P////+ZGIYToLqvGYkNcAAblh/vxNHP4AAAAABJRU5ErkJggg==";
|
|
3
15
|
export class FullscreenButtonGamePlugin extends GamePlugin {
|
|
@@ -5,11 +17,13 @@ export class FullscreenButtonGamePlugin extends GamePlugin {
|
|
|
5
17
|
super();
|
|
6
18
|
this.container = container;
|
|
7
19
|
this.key = FullscreenButtonGamePlugin.key;
|
|
20
|
+
_FullscreenButtonGamePlugin_buttonElement.set(this, void 0);
|
|
21
|
+
_FullscreenButtonGamePlugin_styleElement.set(this, void 0);
|
|
8
22
|
}
|
|
9
23
|
setup() {
|
|
10
24
|
super.setup();
|
|
11
|
-
|
|
12
|
-
|
|
25
|
+
__classPrivateFieldSet(this, _FullscreenButtonGamePlugin_styleElement, document.createElement("style"), "f");
|
|
26
|
+
__classPrivateFieldGet(this, _FullscreenButtonGamePlugin_styleElement, "f").innerHTML = `
|
|
13
27
|
.fullscreen-button {
|
|
14
28
|
position: absolute;
|
|
15
29
|
z-index: 2;
|
|
@@ -30,12 +44,19 @@ export class FullscreenButtonGamePlugin extends GamePlugin {
|
|
|
30
44
|
}
|
|
31
45
|
}
|
|
32
46
|
`;
|
|
33
|
-
document.head.appendChild(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
this.container.appendChild(
|
|
47
|
+
document.head.appendChild(__classPrivateFieldGet(this, _FullscreenButtonGamePlugin_styleElement, "f"));
|
|
48
|
+
__classPrivateFieldSet(this, _FullscreenButtonGamePlugin_buttonElement, document.createElement("div"), "f");
|
|
49
|
+
__classPrivateFieldGet(this, _FullscreenButtonGamePlugin_buttonElement, "f").className = "fullscreen-button";
|
|
50
|
+
__classPrivateFieldGet(this, _FullscreenButtonGamePlugin_buttonElement, "f").addEventListener("click", () => document.body.requestFullscreen(), false);
|
|
51
|
+
this.container.appendChild(__classPrivateFieldGet(this, _FullscreenButtonGamePlugin_buttonElement, "f"));
|
|
52
|
+
}
|
|
53
|
+
destroy() {
|
|
54
|
+
var _a, _b;
|
|
55
|
+
super.destroy();
|
|
56
|
+
(_a = __classPrivateFieldGet(this, _FullscreenButtonGamePlugin_styleElement, "f")) === null || _a === void 0 ? void 0 : _a.remove();
|
|
57
|
+
(_b = __classPrivateFieldGet(this, _FullscreenButtonGamePlugin_buttonElement, "f")) === null || _b === void 0 ? void 0 : _b.remove();
|
|
38
58
|
}
|
|
39
59
|
}
|
|
60
|
+
_FullscreenButtonGamePlugin_buttonElement = new WeakMap(), _FullscreenButtonGamePlugin_styleElement = new WeakMap();
|
|
40
61
|
FullscreenButtonGamePlugin.key = "fullscreen-button";
|
|
41
62
|
//# sourceMappingURL=fullscreen-button-game-plugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fullscreen-button-game-plugin.js","sourceRoot":"","sources":["../../src/plugins/fullscreen-button-game-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,MAAM,SAAS,GACX,8uBAA8uB,CAAC;AAEnvB,MAAM,OAAO,0BAA2B,SAAQ,UAAU;
|
|
1
|
+
{"version":3,"file":"fullscreen-button-game-plugin.js","sourceRoot":"","sources":["../../src/plugins/fullscreen-button-game-plugin.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,MAAM,SAAS,GACX,8uBAA8uB,CAAC;AAEnvB,MAAM,OAAO,0BAA2B,SAAQ,UAAU;IAOtD,YAA6B,SAAsB;QAC/C,KAAK,EAAE,CAAC;QADiB,cAAS,GAAT,SAAS,CAAa;QAL1C,QAAG,GAAG,0BAA0B,CAAC,GAAG,CAAC;QAE9C,4DAA6B;QAC7B,2DAA4B;IAI5B,CAAC;IAED,KAAK;QACD,KAAK,CAAC,KAAK,EAAE,CAAC;QAEd,uBAAA,IAAI,4CAAiB,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,MAAA,CAAC;QACrD,uBAAA,IAAI,gDAAc,CAAC,SAAS,GAAG;;;;;;;;;;+DAUwB,SAAS;;;;;;;;;;SAU/D,CAAC;QACF,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,uBAAA,IAAI,gDAAc,CAAC,CAAC;QAE9C,uBAAA,IAAI,6CAAkB,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,MAAA,CAAC;QACpD,uBAAA,IAAI,iDAAe,CAAC,SAAS,GAAG,mBAAmB,CAAC;QACpD,uBAAA,IAAI,iDAAe,CAAC,gBAAgB,CAChC,OAAO,EACP,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,iBAAiB,EAAE,EACvC,KAAK,CACR,CAAC;QACF,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,uBAAA,IAAI,iDAAe,CAAC,CAAC;IACpD,CAAC;IAED,OAAO;;QACH,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,MAAA,uBAAA,IAAI,gDAAc,0CAAE,MAAM,EAAE,CAAC;QAC7B,MAAA,uBAAA,IAAI,iDAAe,0CAAE,MAAM,EAAE,CAAC;IAClC,CAAC;CACJ;;AApDmB,8BAAG,GAAG,mBAAmB,AAAtB,CAAuB"}
|
|
@@ -2,10 +2,12 @@ import { GamePlugin } from "../game/game-plugin";
|
|
|
2
2
|
import { Tracker } from "../tracking/tracker";
|
|
3
3
|
import { Screen } from "../ui/screen";
|
|
4
4
|
export declare class MetricsGamePlugin extends GamePlugin {
|
|
5
|
+
#private;
|
|
5
6
|
readonly tracker: Tracker;
|
|
6
7
|
static readonly key = "metrics";
|
|
7
8
|
readonly key = "metrics";
|
|
8
9
|
constructor(tracker: Tracker);
|
|
9
10
|
setup(): void;
|
|
11
|
+
destroy(): void;
|
|
10
12
|
setupScreen(screen: Screen): void;
|
|
11
13
|
}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
+
};
|
|
6
|
+
var _MetricsGamePlugin_errorListener, _MetricsGamePlugin_rejectionListner;
|
|
1
7
|
import { GamePlugin } from "../game/game-plugin";
|
|
2
8
|
import { UserCancelledError } from "../navigation/resolver";
|
|
3
9
|
import { TrackingScreenDelegate } from "../tracking/tracking-screen-delegate";
|
|
@@ -6,33 +12,43 @@ export class MetricsGamePlugin extends GamePlugin {
|
|
|
6
12
|
super();
|
|
7
13
|
this.tracker = tracker;
|
|
8
14
|
this.key = MetricsGamePlugin.key;
|
|
9
|
-
|
|
10
|
-
setup() {
|
|
11
|
-
super.setup();
|
|
12
|
-
window.addEventListener("error", (event) => {
|
|
15
|
+
_MetricsGamePlugin_errorListener.set(this, (event) => {
|
|
13
16
|
this.tracker.track("errorOccurred", {
|
|
14
17
|
errorType: "error",
|
|
15
18
|
message: event.message,
|
|
16
19
|
lineno: event.lineno,
|
|
17
20
|
});
|
|
18
21
|
return false;
|
|
19
|
-
}
|
|
20
|
-
|
|
22
|
+
});
|
|
23
|
+
_MetricsGamePlugin_rejectionListner.set(this, (err) => {
|
|
21
24
|
if (err.reason instanceof UserCancelledError) {
|
|
22
25
|
return;
|
|
23
26
|
}
|
|
24
27
|
this.tracker.track("errorOccurred", {
|
|
25
28
|
errorType: "unhandledrejection",
|
|
26
|
-
message: err.reason
|
|
29
|
+
message: err.reason instanceof Error
|
|
30
|
+
? err.reason.message
|
|
31
|
+
: String(err.reason),
|
|
27
32
|
});
|
|
28
33
|
return false;
|
|
29
|
-
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
setup() {
|
|
37
|
+
super.setup();
|
|
38
|
+
window.addEventListener("error", __classPrivateFieldGet(this, _MetricsGamePlugin_errorListener, "f"), false);
|
|
39
|
+
window.addEventListener("unhandledrejection", __classPrivateFieldGet(this, _MetricsGamePlugin_rejectionListner, "f"), false);
|
|
30
40
|
this.tracker.track("gameSetup", {});
|
|
31
41
|
}
|
|
42
|
+
destroy() {
|
|
43
|
+
super.destroy();
|
|
44
|
+
window.removeEventListener("error", __classPrivateFieldGet(this, _MetricsGamePlugin_errorListener, "f"), false);
|
|
45
|
+
window.removeEventListener("unhandledrejection", __classPrivateFieldGet(this, _MetricsGamePlugin_rejectionListner, "f"), false);
|
|
46
|
+
}
|
|
32
47
|
setupScreen(screen) {
|
|
33
48
|
super.setupScreen(screen);
|
|
34
49
|
screen.delegate = new TrackingScreenDelegate(screen, this.tracker);
|
|
35
50
|
}
|
|
36
51
|
}
|
|
52
|
+
_MetricsGamePlugin_errorListener = new WeakMap(), _MetricsGamePlugin_rejectionListner = new WeakMap();
|
|
37
53
|
MetricsGamePlugin.key = "metrics";
|
|
38
54
|
//# sourceMappingURL=metrics-game-plugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics-game-plugin.js","sourceRoot":"","sources":["../../src/plugins/metrics-game-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAG9E,MAAM,OAAO,iBAAkB,SAAQ,UAAU;
|
|
1
|
+
{"version":3,"file":"metrics-game-plugin.js","sourceRoot":"","sources":["../../src/plugins/metrics-game-plugin.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAG9E,MAAM,OAAO,iBAAkB,SAAQ,UAAU;IA2B7C,YAAqB,OAAgB;QACjC,KA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CAAC,mBAAmB,CACtB,oBAAoB,EACpB,uBAAA,IAAI,2CAAkB,EACtB,KAAK,CACR,CAAC;IACN,CAAC;IAED,WAAW,CAAC,MAAc;QACtB,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAC1B,MAAM,CAAC,QAAQ,GAAG,IAAI,sBAAsB,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACvE,CAAC;CACJ;;AA1DmB,qBAAG,GAAG,SAAS,AAAZ,CAAa"}
|
|
@@ -37,6 +37,11 @@ export class VersionLabelGamePlugin extends GamePlugin {
|
|
|
37
37
|
document.head.appendChild(this.styleElement);
|
|
38
38
|
this.container.appendChild(this.labelElement);
|
|
39
39
|
}
|
|
40
|
+
destroy() {
|
|
41
|
+
super.destroy();
|
|
42
|
+
this.styleElement.remove();
|
|
43
|
+
this.labelElement.remove();
|
|
44
|
+
}
|
|
40
45
|
}
|
|
41
46
|
VersionLabelGamePlugin.key = "version-label";
|
|
42
47
|
//# sourceMappingURL=version-label-game-plugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version-label-game-plugin.js","sourceRoot":"","sources":["../../src/plugins/version-label-game-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,MAAM,OAAO,sBAAuB,SAAQ,UAAU;IA+BlD,YACqB,SAAsB,EACtB,KAAa,EACb,UAAU,GAAW,EAAE;QAExC,KAAK,EAAE,CAAC;QAJS,cAAS,GAAT,SAAS,CAAa;QACtB,UAAK,GAAL,KAAK,CAAQ;QACb,eAAU,GAAV,UAAU,CAAa;QAhCnC,QAAG,GAAG,sBAAsB,CAAC,GAAG,CAAC;QAEjC,iBAAY,GAAG,CAAC,GAAG,EAAE;YAC1B,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;YAC5C,KAAK,CAAC,SAAS,GAAG,eAAe,CAAC;YAClC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AC;QAEI,iBAAY,GAAG,CAAC,GAAG,EAAE;YAC1B,MAAM,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;YACjD,QAAQ,CAAC,SAAS,GAAG;;;;;;;;;;;;kBAYX,IAAI,CAAC,UAAU;;SAExB,CAAC;YACF,OAAO,QAAQ,CAAC;QACpB,CAAC,CAAC,EAAE,CAAC;IAQL,CAAC;IAED,KAAK;QACD,KAAK,CAAC,KAAK,EAAE,CAAC;QAEd,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC7C,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAClD,CAAC;IAED,OAAO;QACH,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC;QAC3B,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC;IAC/B,CAAC;CACJ;AAlDmB,0BAAG,GAAG,eAAe,AAAlB,CAAmB"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remvst/game-navigation-core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "Core functionality and plugins",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"author": "Rémi Vansteelandt",
|
|
7
7
|
"license": "UNLICENSED",
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@remvst/animate.js": "3.3.0",
|
|
10
|
-
"@remvst/
|
|
11
|
-
"@remvst/
|
|
10
|
+
"@remvst/client-inputs": "1.2.0",
|
|
11
|
+
"@remvst/optimization": "1.10.0"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"typescript": "^7.0.2"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface FrameTiming {
|
|
2
|
+
/** Whole-frame main-thread time, in ms. */
|
|
3
|
+
frameMs: number;
|
|
4
|
+
/**
|
|
5
|
+
* Time in the cycle phase, in ms. This covers the whole simulation plus any
|
|
6
|
+
* view-controller updates that run inside a screen's `cycle()`. The finer
|
|
7
|
+
* model-vs-render-update split within a frame has to be timed by the game
|
|
8
|
+
* at its own screen-level seam.
|
|
9
|
+
*/
|
|
10
|
+
cycleMs: number;
|
|
11
|
+
/** Time in the render/draw phase, in ms. */
|
|
12
|
+
drawMs: number;
|
|
13
|
+
/** `frameMs − cycleMs − drawMs` — plugin hooks, input, GC, browser. */
|
|
14
|
+
otherMs: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type FrameTimingObserver = (timing: FrameTiming) => void;
|
package/src/game/game-plugin.ts
CHANGED
package/src/game/game.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { GameInputs } from "../interaction/inputs";
|
|
2
2
|
import { ScreenStack } from "../navigation/screen-stack";
|
|
3
|
+
import { FrameTimingObserver } from "./frame-timing";
|
|
3
4
|
import { GameParams } from "./game-params";
|
|
4
5
|
import { GamePlugin } from "./game-plugin";
|
|
5
6
|
|
|
@@ -20,6 +21,8 @@ export abstract class Game<ParamsType extends GameParams = GameParams> {
|
|
|
20
21
|
private animationFrameId: number;
|
|
21
22
|
private runningLoop = false;
|
|
22
23
|
|
|
24
|
+
onFrameTiming: FrameTimingObserver | null = null;
|
|
25
|
+
|
|
23
26
|
constructor(readonly params: ParamsType) {
|
|
24
27
|
this.parseURL();
|
|
25
28
|
}
|
|
@@ -49,10 +52,7 @@ export abstract class Game<ParamsType extends GameParams = GameParams> {
|
|
|
49
52
|
try {
|
|
50
53
|
plugin.setup();
|
|
51
54
|
} catch (err) {
|
|
52
|
-
console.error(
|
|
53
|
-
`Failed to setup ${plugin.key} plugin: ${err.message}`,
|
|
54
|
-
err,
|
|
55
|
-
);
|
|
55
|
+
console.error(`Failed to setup ${plugin.key} plugin`, err);
|
|
56
56
|
throw err;
|
|
57
57
|
}
|
|
58
58
|
}
|
|
@@ -61,6 +61,32 @@ export abstract class Game<ParamsType extends GameParams = GameParams> {
|
|
|
61
61
|
this.scheduleFrame();
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
destroy() {
|
|
65
|
+
this.stopLoop();
|
|
66
|
+
|
|
67
|
+
const errors: unknown[] = [];
|
|
68
|
+
|
|
69
|
+
try {
|
|
70
|
+
this.inputs.destroy();
|
|
71
|
+
} catch (err) {
|
|
72
|
+
console.error(`Failed to destroy inputs`, err);
|
|
73
|
+
errors.push(err);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
for (const plugin of this.plugins) {
|
|
77
|
+
try {
|
|
78
|
+
plugin.destroy();
|
|
79
|
+
} catch (err) {
|
|
80
|
+
console.error(`Failed to destroy ${plugin.key} plugin`, err);
|
|
81
|
+
errors.push(err);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (errors.length > 0) {
|
|
86
|
+
throw errors[0];
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
64
90
|
scheduleFrame() {
|
|
65
91
|
if (this.animationFrameId) {
|
|
66
92
|
return;
|
|
@@ -87,6 +113,8 @@ export abstract class Game<ParamsType extends GameParams = GameParams> {
|
|
|
87
113
|
}
|
|
88
114
|
|
|
89
115
|
frame() {
|
|
116
|
+
const frameStart = window.performance.now();
|
|
117
|
+
|
|
90
118
|
for (const plugin of this.plugins) plugin.onFrameStart();
|
|
91
119
|
|
|
92
120
|
const now = window.performance.now();
|
|
@@ -99,15 +127,29 @@ export abstract class Game<ParamsType extends GameParams = GameParams> {
|
|
|
99
127
|
this.lastFrame = now;
|
|
100
128
|
|
|
101
129
|
for (const plugin of this.plugins) plugin.onCycleStart();
|
|
130
|
+
const cycleStart = window.performance.now();
|
|
102
131
|
this.cycle(elapsed);
|
|
132
|
+
const cycleEnd = window.performance.now();
|
|
103
133
|
for (const plugin of this.plugins) plugin.onCycleEnd();
|
|
104
134
|
|
|
105
135
|
for (const plugin of this.plugins) plugin.onRenderStart();
|
|
136
|
+
const drawStart = window.performance.now();
|
|
106
137
|
for (const plugin of this.plugins) plugin.render();
|
|
138
|
+
const drawEnd = window.performance.now();
|
|
107
139
|
for (const plugin of this.plugins) plugin.onRenderEnd();
|
|
108
140
|
|
|
109
141
|
for (const plugin of this.plugins) plugin.onFrameEnd();
|
|
110
142
|
|
|
143
|
+
const frameMs = window.performance.now() - frameStart;
|
|
144
|
+
const cycleMs = cycleEnd - cycleStart;
|
|
145
|
+
const drawMs = drawEnd - drawStart;
|
|
146
|
+
this.onFrameTiming?.({
|
|
147
|
+
frameMs,
|
|
148
|
+
cycleMs,
|
|
149
|
+
drawMs,
|
|
150
|
+
otherMs: frameMs - cycleMs - drawMs,
|
|
151
|
+
});
|
|
152
|
+
|
|
111
153
|
if (this.runningLoop) {
|
|
112
154
|
this.scheduleFrame();
|
|
113
155
|
}
|
package/src/index.ts
CHANGED
|
@@ -42,6 +42,8 @@ export class GameInputs implements Inputs {
|
|
|
42
42
|
readonly mouse = new DOMMouseInputs(this.game.container, this.game.params);
|
|
43
43
|
readonly gamepad = new DOMGamepadInputs();
|
|
44
44
|
|
|
45
|
+
#blurListener = () => this.reset();
|
|
46
|
+
|
|
45
47
|
constructor(private readonly game: Game) {
|
|
46
48
|
this.keyboard.onKeyDown = (keyCode: number) => {
|
|
47
49
|
this.makeGamepadInactive();
|
|
@@ -101,7 +103,16 @@ export class GameInputs implements Inputs {
|
|
|
101
103
|
this.mouse.setup();
|
|
102
104
|
this.gamepad.setup();
|
|
103
105
|
|
|
104
|
-
window.addEventListener("blur",
|
|
106
|
+
window.addEventListener("blur", this.#blurListener, false);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
destroy() {
|
|
110
|
+
window.removeEventListener("blur", this.#blurListener, false);
|
|
111
|
+
this.reset();
|
|
112
|
+
|
|
113
|
+
this.keyboard.destroy();
|
|
114
|
+
this.mouse.destroy();
|
|
115
|
+
this.gamepad.destroy();
|
|
105
116
|
}
|
|
106
117
|
|
|
107
118
|
reset() {
|
|
@@ -7,13 +7,20 @@ export class BackNavigationPlugin extends GamePlugin {
|
|
|
7
7
|
|
|
8
8
|
private pushedState = false;
|
|
9
9
|
|
|
10
|
+
#onPopStateListener = () => this.onPopState();
|
|
11
|
+
|
|
10
12
|
setup(): void {
|
|
11
13
|
super.setup();
|
|
12
14
|
|
|
13
15
|
const { length } = history;
|
|
14
16
|
if (length > 0) history.go(-length);
|
|
15
17
|
|
|
16
|
-
window.addEventListener("popstate",
|
|
18
|
+
window.addEventListener("popstate", this.#onPopStateListener);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
destroy(): void {
|
|
22
|
+
super.destroy();
|
|
23
|
+
window.removeEventListener("popstate", this.#onPopStateListener);
|
|
17
24
|
}
|
|
18
25
|
|
|
19
26
|
pushState() {
|
|
@@ -6,6 +6,8 @@ export class BlurPausingGamePlugin extends GamePlugin {
|
|
|
6
6
|
|
|
7
7
|
private _enabled = true;
|
|
8
8
|
|
|
9
|
+
#updateLoopListener = () => this.updateLoop();
|
|
10
|
+
|
|
9
11
|
get enabled() {
|
|
10
12
|
return this._enabled;
|
|
11
13
|
}
|
|
@@ -18,8 +20,15 @@ export class BlurPausingGamePlugin extends GamePlugin {
|
|
|
18
20
|
setup(): void {
|
|
19
21
|
super.setup();
|
|
20
22
|
|
|
21
|
-
window.addEventListener("blur",
|
|
22
|
-
window.addEventListener("focus",
|
|
23
|
+
window.addEventListener("blur", this.#updateLoopListener, false);
|
|
24
|
+
window.addEventListener("focus", this.#updateLoopListener, false);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
destroy(): void {
|
|
28
|
+
super.destroy();
|
|
29
|
+
|
|
30
|
+
window.removeEventListener("blur", this.#updateLoopListener, false);
|
|
31
|
+
window.removeEventListener("focus", this.#updateLoopListener, false);
|
|
23
32
|
}
|
|
24
33
|
|
|
25
34
|
private updateLoop() {
|
|
@@ -7,6 +7,9 @@ export class FullscreenButtonGamePlugin extends GamePlugin {
|
|
|
7
7
|
static readonly key = "fullscreen-button";
|
|
8
8
|
readonly key = FullscreenButtonGamePlugin.key;
|
|
9
9
|
|
|
10
|
+
#buttonElement?: HTMLElement;
|
|
11
|
+
#styleElement?: HTMLElement;
|
|
12
|
+
|
|
10
13
|
constructor(private readonly container: HTMLElement) {
|
|
11
14
|
super();
|
|
12
15
|
}
|
|
@@ -14,8 +17,8 @@ export class FullscreenButtonGamePlugin extends GamePlugin {
|
|
|
14
17
|
setup(): void {
|
|
15
18
|
super.setup();
|
|
16
19
|
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
this.#styleElement = document.createElement("style");
|
|
21
|
+
this.#styleElement.innerHTML = `
|
|
19
22
|
.fullscreen-button {
|
|
20
23
|
position: absolute;
|
|
21
24
|
z-index: 2;
|
|
@@ -36,15 +39,21 @@ export class FullscreenButtonGamePlugin extends GamePlugin {
|
|
|
36
39
|
}
|
|
37
40
|
}
|
|
38
41
|
`;
|
|
39
|
-
document.head.appendChild(
|
|
42
|
+
document.head.appendChild(this.#styleElement);
|
|
40
43
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
+
this.#buttonElement = document.createElement("div");
|
|
45
|
+
this.#buttonElement.className = "fullscreen-button";
|
|
46
|
+
this.#buttonElement.addEventListener(
|
|
44
47
|
"click",
|
|
45
48
|
() => document.body.requestFullscreen(),
|
|
46
49
|
false,
|
|
47
50
|
);
|
|
48
|
-
this.container.appendChild(
|
|
51
|
+
this.container.appendChild(this.#buttonElement);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
destroy(): void {
|
|
55
|
+
super.destroy();
|
|
56
|
+
this.#styleElement?.remove();
|
|
57
|
+
this.#buttonElement?.remove();
|
|
49
58
|
}
|
|
50
59
|
}
|
|
@@ -8,6 +8,29 @@ export class MetricsGamePlugin extends GamePlugin {
|
|
|
8
8
|
static readonly key = "metrics";
|
|
9
9
|
readonly key = MetricsGamePlugin.key;
|
|
10
10
|
|
|
11
|
+
#errorListener = (event: ErrorEvent) => {
|
|
12
|
+
this.tracker.track("errorOccurred", {
|
|
13
|
+
errorType: "error",
|
|
14
|
+
message: event.message,
|
|
15
|
+
lineno: event.lineno,
|
|
16
|
+
});
|
|
17
|
+
return false;
|
|
18
|
+
};
|
|
19
|
+
#rejectionListner = (err: PromiseRejectionEvent) => {
|
|
20
|
+
if (err.reason instanceof UserCancelledError) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
this.tracker.track("errorOccurred", {
|
|
25
|
+
errorType: "unhandledrejection",
|
|
26
|
+
message:
|
|
27
|
+
err.reason instanceof Error
|
|
28
|
+
? err.reason.message
|
|
29
|
+
: String(err.reason),
|
|
30
|
+
});
|
|
31
|
+
return false;
|
|
32
|
+
};
|
|
33
|
+
|
|
11
34
|
constructor(readonly tracker: Tracker) {
|
|
12
35
|
super();
|
|
13
36
|
}
|
|
@@ -15,37 +38,27 @@ export class MetricsGamePlugin extends GamePlugin {
|
|
|
15
38
|
setup(): void {
|
|
16
39
|
super.setup();
|
|
17
40
|
|
|
18
|
-
window.addEventListener(
|
|
19
|
-
"error",
|
|
20
|
-
(event) => {
|
|
21
|
-
this.tracker.track("errorOccurred", {
|
|
22
|
-
errorType: "error",
|
|
23
|
-
message: event.message,
|
|
24
|
-
lineno: event.lineno,
|
|
25
|
-
});
|
|
26
|
-
return false;
|
|
27
|
-
},
|
|
28
|
-
false,
|
|
29
|
-
);
|
|
41
|
+
window.addEventListener("error", this.#errorListener, false);
|
|
30
42
|
window.addEventListener(
|
|
31
43
|
"unhandledrejection",
|
|
32
|
-
|
|
33
|
-
if (err.reason instanceof UserCancelledError) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
this.tracker.track("errorOccurred", {
|
|
38
|
-
errorType: "unhandledrejection",
|
|
39
|
-
message: err.reason.message,
|
|
40
|
-
});
|
|
41
|
-
return false;
|
|
42
|
-
},
|
|
44
|
+
this.#rejectionListner,
|
|
43
45
|
false,
|
|
44
46
|
);
|
|
45
47
|
|
|
46
48
|
this.tracker.track("gameSetup", {});
|
|
47
49
|
}
|
|
48
50
|
|
|
51
|
+
destroy(): void {
|
|
52
|
+
super.destroy();
|
|
53
|
+
|
|
54
|
+
window.removeEventListener("error", this.#errorListener, false);
|
|
55
|
+
window.removeEventListener(
|
|
56
|
+
"unhandledrejection",
|
|
57
|
+
this.#rejectionListner,
|
|
58
|
+
false,
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
49
62
|
setupScreen(screen: Screen): void {
|
|
50
63
|
super.setupScreen(screen);
|
|
51
64
|
screen.delegate = new TrackingScreenDelegate(screen, this.tracker);
|
|
@@ -45,4 +45,10 @@ export class VersionLabelGamePlugin extends GamePlugin {
|
|
|
45
45
|
document.head.appendChild(this.styleElement);
|
|
46
46
|
this.container.appendChild(this.labelElement);
|
|
47
47
|
}
|
|
48
|
+
|
|
49
|
+
destroy(): void {
|
|
50
|
+
super.destroy();
|
|
51
|
+
this.styleElement.remove();
|
|
52
|
+
this.labelElement.remove();
|
|
53
|
+
}
|
|
48
54
|
}
|