mirror of
https://github.com/denoland/deno.git
synced 2024-11-24 15:19:26 -05:00
Use object destructing (#130)
This commit is contained in:
parent
78124cd45f
commit
58eb14031d
2 changed files with 11 additions and 10 deletions
12
main.ts
12
main.ts
|
@ -34,11 +34,13 @@ let startCalled = false;
|
|||
startCalled = true;
|
||||
|
||||
const msg = pb.Msg.decode(payload);
|
||||
const cwd = msg.startCwd;
|
||||
const argv = msg.startArgv;
|
||||
const debugFlag = msg.startDebugFlag;
|
||||
const mainJs = msg.startMainJs;
|
||||
const mainMap = msg.startMainMap;
|
||||
const {
|
||||
startCwd: cwd,
|
||||
startArgv: argv,
|
||||
startDebugFlag: debugFlag,
|
||||
startMainJs: mainJs,
|
||||
startMainMap: mainMap
|
||||
} = msg;
|
||||
|
||||
debug = debugFlag;
|
||||
util.log("start", { cwd, argv, debugFlag });
|
||||
|
|
|
@ -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…
Reference in a new issue