| @@ -82,11 +82,18 @@ function stopRoomTimers(room, state) { | |||||
| } | } | ||||
| function stopClassTimers(timerClass, state) { | |||||
| function stopClassTimers(timerClass, state, inverse) { | |||||
| const matches = state.timers.filter(timer => timer.classes.includes(timerClass)); | const matches = state.timers.filter(timer => timer.classes.includes(timerClass)); | ||||
| matches.forEach(timer => clearTimeout(timer.timeout)); | |||||
| const others = state.timers.filter(timer => !timer.classes.includes(timerClass)); | |||||
| if (inverse) { | |||||
| others.forEach(timer => clearTimeout(timer.timeout)); | |||||
| state.timers = matches; | |||||
| } else { | |||||
| matches.forEach(timer => clearTimeout(timer.timeout)); | |||||
| state.timers = others; | |||||
| } | |||||
| state.timers = state.timers.filter(timer => !timer.classes.includes(timerClass)); | |||||
| } | } | ||||