shapez.io/src/js/core/globals.js
Даниїл Григор'єв c4e9d417b3
Re-use global app variable in ModLoader
The linkApp method is removed as it was unused. A getter is used to
ensure best development experience. It can be further improved by adding
a guard for cases where GLOBAL_APP is not set yet.
2025-04-11 00:01:57 +03:00

28 lines
776 B
JavaScript

/* typehints:start */
import { Application } from "../application";
/* typehints:end */
/**
* Used for the bug reporter, and the click detector which both have no handles to this.
* It would be nicer to have no globals, but this is the only one. I promise!
* @type {Application} */
export let GLOBAL_APP = null;
/**
* @param {Application} app
*/
export function setGlobalApp(app) {
assert(!GLOBAL_APP, "Tried to set GLOBAL_APP twice");
GLOBAL_APP = app;
}
export const BUILD_OPTIONS = {
HAVE_ASSERT: G_HAVE_ASSERT,
APP_ENVIRONMENT: G_APP_ENVIRONMENT,
IS_DEV: G_IS_DEV,
IS_RELEASE: G_IS_RELEASE,
BUILD_TIME: G_BUILD_TIME,
BUILD_COMMIT_HASH: G_BUILD_COMMIT_HASH,
BUILD_VERSION: G_BUILD_VERSION,
ALL_UI_IMAGES: G_ALL_UI_IMAGES,
};