From fc8e3dcdcff1253d3977f23a922bd4ae5cec0d49 Mon Sep 17 00:00:00 2001 From: Cazka Date: Mon, 3 Oct 2022 21:55:31 +0200 Subject: [PATCH] change reference to _window --- src/apis/game.ts | 2 +- src/apis/gamepad.ts | 2 +- src/apis/minimap.ts | 4 ++-- src/core/canvas_kit.ts | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/apis/game.ts b/src/apis/game.ts index fd19a95..5e9713d 100644 --- a/src/apis/game.ts +++ b/src/apis/game.ts @@ -11,7 +11,7 @@ class Game extends EventEmitter { } #onframe(): void { - if (!this.#ready && window.input !== undefined) { + if (!this.#ready && _window.input !== undefined) { this.#ready = true; this.#onready(); } diff --git a/src/apis/gamepad.ts b/src/apis/gamepad.ts index 38ac7e7..a479697 100644 --- a/src/apis/gamepad.ts +++ b/src/apis/gamepad.ts @@ -20,7 +20,7 @@ class Gamepad { }); this.connected = false; - window.navigator.getGamepads = new Proxy(window.navigator.getGamepads, { + _window.navigator.getGamepads = new Proxy(_window.navigator.getGamepads, { apply: (target, thisArg, args) => { if (this.connected) return [this.#toGamepad()]; return Reflect.apply(target, thisArg, args); diff --git a/src/apis/minimap.ts b/src/apis/minimap.ts index 9ec39c9..676cdf3 100644 --- a/src/apis/minimap.ts +++ b/src/apis/minimap.ts @@ -74,8 +74,8 @@ class Minimap { return Reflect.apply(target, thisArg, args); } if ( - Math.abs(transform.a / transform.d - window.innerWidth / window.innerHeight) > - (window.innerWidth / window.innerHeight) * 0.000_05 + Math.abs(transform.a / transform.d - _window.innerWidth / _window.innerHeight) > + (_window.innerWidth / _window.innerHeight) * 0.000_05 ) { return Reflect.apply(target, thisArg, args); } diff --git a/src/core/canvas_kit.ts b/src/core/canvas_kit.ts index 510b6d8..c4b813e 100644 --- a/src/core/canvas_kit.ts +++ b/src/core/canvas_kit.ts @@ -23,7 +23,7 @@ export class CanvasKit { * The consumer will be called before. */ static hookRAF(consumer: () => void): void { - window.requestAnimationFrame = new Proxy(window.requestAnimationFrame, { + _window.requestAnimationFrame = new Proxy(_window.requestAnimationFrame, { apply(target, thisArg, args) { consumer(); return Reflect.apply(target, thisArg, args);