Compare commits
2 Commits
4114f0a4a4
...
e299b96d15
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e299b96d15 | ||
|
|
7852cda9e6 |
@@ -10,6 +10,10 @@ class TimerMgr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
create(id, timeout, func) {
|
create(id, timeout, func) {
|
||||||
|
if (this.hasTimer(id)) {
|
||||||
|
log.error(`Timer with id ${id} already exists`);
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
@@ -37,8 +41,12 @@ class TimerMgr {
|
|||||||
return this.#timers.hasOwnProperty(id);
|
return this.#timers.hasOwnProperty(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
isActive(identifier) {
|
isActive(id) {
|
||||||
return this.#timers[identifier].isActive();
|
if (!this.hasTimer(id)) {
|
||||||
|
log.warn(`No timer with id ${id} found`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return this.#timers[id].isActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
cancelAll() {
|
cancelAll() {
|
||||||
|
|||||||
Reference in New Issue
Block a user