feat: basic hooks test

This commit is contained in:
Zlatko Đurić 2025-04-13 12:36:29 +02:00
parent 8451ba6e3d
commit 249cfdf95f
6 changed files with 35 additions and 7 deletions

1
lang/de.json Normal file
View File

@ -0,0 +1 @@
{}

1
lang/en.json Normal file
View File

@ -0,0 +1 @@
{}

1
lang/hr.json Normal file
View File

@ -0,0 +1 @@
{}

View File

@ -14,6 +14,9 @@
"minimum": 12, "minimum": 12,
"verified": 12 "verified": 12
}, },
"esmodules": [
"src/timer.js"
],
"languages": [ "languages": [
{ {
"lang": "en", "lang": "en",
@ -21,17 +24,17 @@
"path": "lang/en.json" "path": "lang/en.json"
}, },
{ {
"lang": "en", "lang": "de",
"name": "English", "name": "Deutsch",
"path": "lang/en.json" "path": "lang/de.json"
}, },
{ {
"lang": "en", "lang": "hr",
"name": "English", "name": "Hrvatski",
"path": "lang/en.json" "path": "lang/hr.json"
} }
], ],
"url": "https://zlatko.dev/projects/vtt-timer", "url": "https://zlatko.dev/projects/vtt-timer",
"manifest": "https://gitea.zlatko.dev/vtt/timer", "manifest": "https://gitea.zlatko.dev/vtt/timer",
"download": "missing-url" "download": "https://gitea.zlatko.dev/vtt/timer/archive/v0.1.0.zip"
} }

View File

@ -2,6 +2,7 @@
"name": "@zladuric/timer", "name": "@zladuric/timer",
"version": "0.0.1", "version": "0.0.1",
"main": "index.js", "main": "index.js",
"type": "module",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },

21
src/timer.js Normal file
View File

@ -0,0 +1,21 @@
console.log('We just booted!');
Hooks.on('init', function() {
console.log('Timer module init');
});
Hooks.on('ready', function() {
console.log('Timer module ready');
});
Hooks.on('error', function(location, error, payload) {
console.error(`Timer module error at ${location}`, error, payload ?? 'no payload');
});
Hooks.on('pauseGame', function(paused) {
if (paused) {
console.log('Game paused.');
} else {
console.log('Game unpaused');
}
});