summaryrefslogtreecommitdiff
path: root/ext/web/timers.rs
diff options
context:
space:
mode:
Diffstat (limited to 'ext/web/timers.rs')
-rw-r--r--ext/web/timers.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/ext/web/timers.rs b/ext/web/timers.rs
index 7f17aa969..9a78240f7 100644
--- a/ext/web/timers.rs
+++ b/ext/web/timers.rs
@@ -3,6 +3,8 @@
//! This module helps deno implement timers and performance APIs.
use deno_core::error::AnyError;
+use deno_core::op;
+
use deno_core::CancelFuture;
use deno_core::CancelHandle;
use deno_core::OpState;
@@ -25,6 +27,7 @@ pub type StartTime = Instant;
// since the start time of the deno runtime.
// If the High precision flag is not set, the
// nanoseconds are rounded on 2ms.
+#[op]
pub fn op_now<TP>(
state: &mut OpState,
_argument: (),
@@ -64,6 +67,7 @@ impl Resource for TimerHandle {
/// Creates a [`TimerHandle`] resource that can be used to cancel invocations of
/// [`op_sleep`].
+#[op]
pub fn op_timer_handle(
state: &mut OpState,
_: (),
@@ -77,6 +81,7 @@ pub fn op_timer_handle(
/// Waits asynchronously until either `millis` milliseconds have passed or the
/// [`TimerHandle`] resource given by `rid` has been canceled.
+#[op]
pub async fn op_sleep(
state: Rc<RefCell<OpState>>,
millis: u64,
@@ -89,6 +94,7 @@ pub async fn op_sleep(
Ok(())
}
+#[op]
pub fn op_sleep_sync<TP>(
state: &mut OpState,
millis: u64,