Add data validation and a world setting for enabling the Global API
This commit is contained in:
parent
c3d632274a
commit
354b22da57
7 changed files with 180 additions and 56 deletions
|
|
@ -9,6 +9,7 @@ import { TableCreator } from "../Apps/TableCreator.mjs";
|
|||
import { TableManager } from "../Apps/TableManager.mjs";
|
||||
|
||||
// Misc Imports
|
||||
import { api } from "../api.mjs";
|
||||
import helpers from "../handlebarsHelpers/_index.mjs";
|
||||
import { Logger } from "../utils/Logger.mjs";
|
||||
import { registerCustomComponents } from "../Apps/elements/_index.mjs";
|
||||
|
|
@ -45,6 +46,18 @@ Hooks.on(`init`, () => {
|
|||
CONFIG.stats.db = MemoryDatabase;
|
||||
};
|
||||
|
||||
game.modules.get(__ID__).api = api;
|
||||
if (game.settings.get(__ID__, `globalAPI`)) {
|
||||
Object.defineProperty(
|
||||
globalThis,
|
||||
`stats`,
|
||||
{
|
||||
value: api,
|
||||
writable: false,
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
Handlebars.registerHelper(helpers);
|
||||
registerCustomComponents();
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue