|
|
|
@@ -98,7 +98,6 @@ function updateStatDisplay(stats, statType) { |
|
|
|
func: the function to invoke |
|
|
|
delay: how long to wait between invocations |
|
|
|
loop: false = no looping, true = loop forever |
|
|
|
room: the room associated with the timer |
|
|
|
} |
|
|
|
|
|
|
|
Returns the timeout id - but you still need to cancel it through stopTimer! |
|
|
|
@@ -126,8 +125,8 @@ function startTimer(config, state) { |
|
|
|
} |
|
|
|
|
|
|
|
}, config.delay); |
|
|
|
|
|
|
|
state.timers.push({id: config.id, timeout: timeout, room: config.room, classes: config.classes || []}); |
|
|
|
|
|
|
|
state.timers.push({id: config.id, timeout: timeout, classes: config.classes || []}); |
|
|
|
|
|
|
|
return timeout; |
|
|
|
} |
|
|
|
@@ -139,13 +138,6 @@ function stopTimer(id, state) { |
|
|
|
state.timers = state.timers.filter(timer => timer.id != id); |
|
|
|
} |
|
|
|
|
|
|
|
function stopRoomTimers(room, state) { |
|
|
|
const matches = state.timers.filter(timer => timer.room == room); |
|
|
|
matches.forEach(timer => clearTimeout(timer.timeout)); |
|
|
|
|
|
|
|
state.timers = state.timers.filter(timer => timer.room != room); |
|
|
|
} |
|
|
|
|
|
|
|
function stopClassTimers(timerClass, state, inverse) { |
|
|
|
const matches = state.timers.filter(timer => timer.classes.includes(timerClass)); |
|
|
|
const others = state.timers.filter(timer => !timer.classes.includes(timerClass)); |
|
|
|
|