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,
"verified": 12
},
"esmodules": [
"src/timer.js"
],
"languages": [
{
"lang": "en",
@ -21,17 +24,17 @@
"path": "lang/en.json"
},
{
"lang": "en",
"name": "English",
"path": "lang/en.json"
"lang": "de",
"name": "Deutsch",
"path": "lang/de.json"
},
{
"lang": "en",
"name": "English",
"path": "lang/en.json"
"lang": "hr",
"name": "Hrvatski",
"path": "lang/hr.json"
}
],
"url": "https://zlatko.dev/projects/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",
"version": "0.0.1",
"main": "index.js",
"type": "module",
"scripts": {
"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');
}
});