From 202ca09d181256c80192b9c5969bc8e4f0589bdb Mon Sep 17 00:00:00 2001 From: Mike Bloy Date: Sat, 9 Sep 2023 23:29:32 -0500 Subject: [PATCH] update shim const handling --- scripts/module.js | 6 ++---- scripts/shim.js | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/scripts/module.js b/scripts/module.js index 11e58ed..71ec9e8 100644 --- a/scripts/module.js +++ b/scripts/module.js @@ -1,12 +1,12 @@ import { api } from './api.js' -import { log, shim, CONST } from './shim.js' +import { log } from './shim.js' function _checkModule (name) { if (!game.modules.get(name)?.active && game.user.isGM) { let action = 'install and activate' if (game.modules.get(name)) action = 'activate' ui.notifications.error( - `SWADE MB Helpers requires the ${name} module. Please ${action} it.`) + `SWADE MB Helpers requires the ${name} module. Please ${action} it.`) } } @@ -14,7 +14,5 @@ Hooks.on('setup', api.registerFunctions) Hooks.on('ready', () => { _checkModule('warpgate') - CONST.FOUNDRY = foundry.CONST - CONST.SWADE = CONFIG.SWADE.CONST log('Initialized SWADE MB Helpers') }) diff --git a/scripts/shim.js b/scripts/shim.js index 22d1571..591c9f5 100644 --- a/scripts/shim.js +++ b/scripts/shim.js @@ -1,6 +1,15 @@ -export const CONST = { - SWADE: null, - FOUNDRY: null +export class CONST { + static get SWADE () { + return CONFIG.SWADE.CONST + } + + static get FOUNDRY () { + return foundry.CONST + } + + static get WARPGATE () { + return warpgate.CONST + } } export class shim {