mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 20:29:11 +00:00
Use object destructing (#130)
This commit is contained in:
parent
78124cd45f
commit
58eb14031d
2 changed files with 11 additions and 10 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue