summaryrefslogtreecommitdiff
path: root/timers.ts
diff options
context:
space:
mode:
Diffstat (limited to 'timers.ts')
-rw-r--r--timers.ts9
1 files changed, 4 insertions, 5 deletions
diff --git a/timers.ts b/timers.ts
index 136ae745c..cddb859d9 100644
--- a/timers.ts
+++ b/timers.ts
@@ -27,15 +27,14 @@ export function initTimers() {
function onMessage(payload: Uint8Array) {
const msg = pb.Msg.decode(payload);
assert(msg.command === pb.Msg.Command.TIMER_READY);
- const id = msg.timerReadyId;
- const done = msg.timerReadyDone;
- const timer = timers.get(id);
+ const { timerReadyId, timerReadyDone } = msg;
+ const timer = timers.get(timerReadyId);
if (!timer) {
return;
}
timer.cb(...timer.args);
- if (done) {
- timers.delete(id);
+ if (timerReadyDone) {
+ timers.delete(timerReadyId);
}
}