summaryrefslogtreecommitdiff
path: root/ext/web/02_timers.js
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-05-01 17:40:00 +0200
committerGitHub <noreply@github.com>2023-05-01 17:40:00 +0200
commitdcf391ffed3850f9026d88b146e156375c4619d4 (patch)
tree2134755e8abbecaba1d42703fe727ae701ee390c /ext/web/02_timers.js
parent6728ad4203d731e555dabf89ec6157f113454ce6 (diff)
refactor: migrate async ops to generated wrappers (#18937)
Migrates some of existing async ops to generated wrappers introduced in https://github.com/denoland/deno/pull/18887. As a result "core.opAsync2" was removed. I will follow up with more PRs that migrate all the async ops to generated wrappers.
Diffstat (limited to 'ext/web/02_timers.js')
-rw-r--r--ext/web/02_timers.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/web/02_timers.js b/ext/web/02_timers.js
index 78cf06e44..cfd85a055 100644
--- a/ext/web/02_timers.js
+++ b/ext/web/02_timers.js
@@ -1,5 +1,7 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+// deno-lint-ignore-file camelcase
+
const core = globalThis.Deno.core;
const ops = core.ops;
const primordials = globalThis.__bootstrap.primordials;
@@ -13,7 +15,6 @@ const {
MapPrototypeSet,
Uint8Array,
Uint32Array,
- // deno-lint-ignore camelcase
NumberPOSITIVE_INFINITY,
PromisePrototypeThen,
SafeArrayIterator,
@@ -26,6 +27,7 @@ const {
import * as webidl from "ext:deno_webidl/00_webidl.js";
import { reportException } from "ext:deno_web/02_event.js";
import { assert } from "ext:deno_web/00_infra.js";
+const { op_sleep } = core.generateAsyncOpHandler("op_sleep");
const hrU8 = new Uint8Array(8);
const hr = new Uint32Array(TypedArrayPrototypeGetBuffer(hrU8));
@@ -216,7 +218,7 @@ const scheduledTimers = { head: null, tail: null };
*/
function runAfterTimeout(cb, millis, timerInfo) {
const cancelRid = timerInfo.cancelRid;
- const sleepPromise = core.opAsync2("op_sleep", millis, cancelRid);
+ const sleepPromise = op_sleep(millis, cancelRid);
timerInfo.promiseId = sleepPromise[SymbolFor("Deno.core.internalPromiseId")];
if (!timerInfo.isRef) {
core.unrefOp(timerInfo.promiseId);