feat(timers): allow passing additional parameters to timers

This commit is contained in:
Christian Weimann
2025-01-12 19:19:57 +01:00
parent b9e5c22184
commit 4a7185a1a5

View File

@@ -9,13 +9,13 @@ class TimerMgr {
log.info('Initialization of TimerMgr helper class'); log.info('Initialization of TimerMgr helper class');
} }
create(id, timeout, func) { create(id, timeout, func, ...params) {
if (this.hasTimer(id)) { if (this.hasTimer(id)) {
log.error(`Timer with id ${id} already exists`); log.error(`Timer with id ${id} already exists`);
return; return;
} }
log.debug("Create timer with id " + id); log.debug("Create timer with id " + id);
this.#timers[id] = actions.ScriptExecution.createTimer(id, timeout, func); this.#timers[id] = actions.ScriptExecution.createTimer(id, timeout, func, ...params);
} }
cancel(id) { cancel(id) {