diff --git a/src/js/application.js b/src/js/application.js index 421f50d2..71115f54 100644 --- a/src/js/application.js +++ b/src/js/application.js @@ -1,7 +1,7 @@ import { AnimationFrame } from "./core/animation_frame"; import { BackgroundResourcesLoader } from "./core/background_resources_loader"; import { GameState } from "./core/game_state"; -import { GLOBAL_APP, setGlobalApp } from "./core/globals"; +import { setGlobalApp } from "./core/globals"; import { InputDistributor } from "./core/input_distributor"; import { Loader } from "./core/loader"; import { createLogger } from "./core/logging"; @@ -41,10 +41,8 @@ export class Application { async boot() { console.log("Booting ..."); - assert(!GLOBAL_APP, "Tried to construct application twice"); logger.log("Creating application, platform =", getPlatformName()); setGlobalApp(this); - MODS.app = this; // MODS diff --git a/src/js/core/globals.js b/src/js/core/globals.js index 4e046824..41ffdf48 100644 --- a/src/js/core/globals.js +++ b/src/js/core/globals.js @@ -12,7 +12,7 @@ export let GLOBAL_APP = null; * @param {Application} app */ export function setGlobalApp(app) { - assert(!GLOBAL_APP, "Create application twice!"); + assert(!GLOBAL_APP, "Tried to set GLOBAL_APP twice"); GLOBAL_APP = app; } diff --git a/src/js/mods/modloader.js b/src/js/mods/modloader.js index 2e2b8845..cbc6f086 100644 --- a/src/js/mods/modloader.js +++ b/src/js/mods/modloader.js @@ -1,6 +1,3 @@ -/* typehints:start */ -import { Application } from "../application"; -/* typehints:end */ import { FsError } from "@/platform/fs_error"; import { globalConfig } from "../core/config"; import { createLogger } from "../core/logging"; @@ -9,6 +6,7 @@ import { Mod } from "./mod"; import { ModInterface } from "./mod_interface"; import { MOD_SIGNALS } from "./mod_signals"; +import { GLOBAL_APP } from "@/core/globals"; import semverSatisifies from "semver/functions/satisfies"; import semverValidRange from "semver/ranges/valid"; @@ -32,11 +30,6 @@ export class ModLoader { constructor() { LOG.log("modloader created"); - /** - * @type {Application} - */ - this.app = undefined; - /** @type {Mod[]} */ this.mods = []; @@ -50,8 +43,8 @@ export class ModLoader { this.signals = MOD_SIGNALS; } - linkApp(app) { - this.app = app; + get app() { + return GLOBAL_APP; } anyModsActive() {