feat(timers): allow passing additional parameters to timers
This commit is contained in:
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user