Simplify timer with macrotask callback (#4385)

This commit is contained in:
Kevin (Kun) "Kassimo" Qian 2020-03-19 07:45:28 -07:00 committed by GitHub
parent 8c1c929034
commit 2f3de4b425
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 140 additions and 77 deletions

View file

@ -7,6 +7,7 @@ import { setBuildInfo } from "./build.ts";
import { setVersions } from "./version.ts";
import { setPrepareStackTrace } from "./error_stack.ts";
import { Start, start as startOp } from "./ops/runtime.ts";
import { handleTimerMacrotask } from "./web/timers.ts";
export let OPS_CACHE: { [name: string]: number };
@ -27,6 +28,7 @@ export function initOps(): void {
for (const [name, opId] of Object.entries(OPS_CACHE)) {
core.setAsyncHandler(opId, getAsyncHandler(name));
}
core.setMacrotaskCallback(handleTimerMacrotask);
}
export function start(source?: string): Start {