Initialize module and get base level functionality operating
This commit is contained in:
parent
5741bc64e2
commit
cb3bc7c86c
7 changed files with 67 additions and 0 deletions
7
module/consts.mjs
Normal file
7
module/consts.mjs
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
// MARK: filePath
|
||||||
|
export function filePath(path) {
|
||||||
|
if (path.startsWith(`/`)) {
|
||||||
|
path = path.slice(1);
|
||||||
|
};
|
||||||
|
return `modules/${__ID__}/${path}`;
|
||||||
|
};
|
||||||
8
module/hooks/init.mjs
Normal file
8
module/hooks/init.mjs
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
import { registerMetaSettings } from "../settings/meta.mjs";
|
||||||
|
import { Logger } from "../utils/Logger.mjs";
|
||||||
|
|
||||||
|
Hooks.on(`init`, () => {
|
||||||
|
Logger.debug(`Initializing`);
|
||||||
|
|
||||||
|
registerMetaSettings();
|
||||||
|
});
|
||||||
5
module/hooks/ready.mjs
Normal file
5
module/hooks/ready.mjs
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
import { Logger } from "../utils/Logger.mjs";
|
||||||
|
|
||||||
|
Hooks.on(`ready`, () => {
|
||||||
|
Logger.log(`Version: ${__VERSION__}`);
|
||||||
|
});
|
||||||
4
module/main.mjs
Normal file
4
module/main.mjs
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
import "./api.mjs";
|
||||||
|
|
||||||
|
import "./hooks/init.mjs";
|
||||||
|
import "./hooks/ready.mjs";
|
||||||
8
module/settings/meta.mjs
Normal file
8
module/settings/meta.mjs
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
export function registerMetaSettings() {
|
||||||
|
game.settings.register(__ID__, `data`, {
|
||||||
|
scope: `user`,
|
||||||
|
type: Object,
|
||||||
|
config: false,
|
||||||
|
requiresReload: false,
|
||||||
|
});
|
||||||
|
};
|
||||||
22
module/utils/Logger.mjs
Normal file
22
module/utils/Logger.mjs
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
const augmentedProps = new Set([
|
||||||
|
`debug`,
|
||||||
|
`log`,
|
||||||
|
`error`,
|
||||||
|
`info`,
|
||||||
|
`warn`,
|
||||||
|
`group`,
|
||||||
|
`time`,
|
||||||
|
`timeEnd`,
|
||||||
|
`timeLog`,
|
||||||
|
`timeStamp`,
|
||||||
|
]);
|
||||||
|
|
||||||
|
/** @type {Console} */
|
||||||
|
export const Logger = new Proxy(console, {
|
||||||
|
get(target, prop, _receiver) {
|
||||||
|
if (augmentedProps.has(prop)) {
|
||||||
|
return target[prop].bind(target, __ID__, `|`);
|
||||||
|
};
|
||||||
|
return target[prop];
|
||||||
|
},
|
||||||
|
});
|
||||||
13
public/module.json
Normal file
13
public/module.json
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"id": "stat-tracker",
|
||||||
|
"title": "Stats Tracker",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"compatibility": {
|
||||||
|
"maximum": 13,
|
||||||
|
"verified": 13,
|
||||||
|
"minimum": 13
|
||||||
|
},
|
||||||
|
"esmodules": [
|
||||||
|
"./module.mjs"
|
||||||
|
]
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue