summaryrefslogtreecommitdiff
path: root/cli/js/timers.ts
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2020-03-09 15:18:02 +0100
committerGitHub <noreply@github.com>2020-03-09 15:18:02 +0100
commit886f330ec8110a3eb72feb14353f353962179d2e (patch)
treef6b458afac30a18d5120396bed9b1e63ae6d8529 /cli/js/timers.ts
parent1b6fc87b7188118896f797e5f0dab309775def71 (diff)
reorg: move JS ops implementations to cli/js/ops/, part 2 (#4283)
Following JS ops were moved to separate files in cli/js/ops directory: - io - process - worker_host - web_worker - plugins - timers - signal - permissions
Diffstat (limited to 'cli/js/timers.ts')
-rw-r--r--cli/js/timers.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/cli/js/timers.ts b/cli/js/timers.ts
index 31f81332a..844a0b204 100644
--- a/cli/js/timers.ts
+++ b/cli/js/timers.ts
@@ -1,6 +1,6 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import { assert } from "./util.ts";
-import { sendSync, sendAsync } from "./ops/dispatch_json.ts";
+import { startGlobalTimer, stopGlobalTimer } from "./ops/timers.ts";
import { RBTree } from "./rbtree.ts";
const { console } = globalThis;
@@ -26,7 +26,7 @@ const dueTree = new RBTree<DueNode>((a, b) => a.due - b.due);
function clearGlobalTimeout(): void {
globalTimeoutDue = null;
- sendSync("op_global_timer_stop");
+ stopGlobalTimer();
}
let pendingEvents = 0;
@@ -51,7 +51,7 @@ async function setGlobalTimeout(due: number, now: number): Promise<void> {
// some timeout/defer is put in place to allow promise resolution.
// Ideally `clearGlobalTimeout` doesn't return until this op is resolved, but
// I'm not if that's possible.
- await sendAsync("op_global_timer", { timeout });
+ await startGlobalTimer(timeout);
pendingEvents--;
// eslint-disable-next-line @typescript-eslint/no-use-before-define
fireTimers();