Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Oct 16, 2018
1 parent c12edc6 commit 3584139
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
18 changes: 11 additions & 7 deletions js/dispatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,27 @@ const promiseTable = new Map<number, util.Resolvable<msg.Base>>();

let fireTimers: () => number;
let nTasks = 0; // Number of async tasks pending.
let delay = 0; // Cached return value of fireTimers.

function eventLoopLog(delay: number): void {
function eventLoopLog(): void {
util.log(`TICK delay ${delay} nTasks ${nTasks}`);
}

function idle(): boolean {
delay = fireTimers();
return delay < 0 && nTasks === 0;
}

export function eventLoop(): boolean {
for (;;) {
let delay = fireTimers();
if (delay < 0 && nTasks == 0) {
if (idle()) {
libdeno.runMicrotasks();
delay = fireTimers();
if (delay < 0 && nTasks == 0) {
if (idle()) {
break;
}
}
eventLoopLog(delay);
let ui8 = poll(delay);
eventLoopLog();
const ui8 = poll(delay);
if (ui8 != null) {
handleAsyncMsgFromRust(ui8);
libdeno.runMicrotasks();
Expand Down
2 changes: 0 additions & 2 deletions js/libdeno.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ interface Libdeno {
) => void
) => void;

setPromiseErrorExaminer: (handler: () => boolean) => void;

mainSource: string;
mainSourceMap: RawSourceMap;
}
Expand Down

0 comments on commit 3584139

Please sign in to comment.