summaryrefslogtreecommitdiff
path: root/runtime/ops/fs_events.rs
diff options
context:
space:
mode:
authorAaron O'Mullan <aaron.omullan@gmail.com>2021-05-03 01:22:57 +0200
committerGitHub <noreply@github.com>2021-05-02 19:22:57 -0400
commit8377957666d6ca80d48d6fa78afd3e16bf3f7aa8 (patch)
tree071564d391846624c18b81cdccf3350c2e73ed13 /runtime/ops/fs_events.rs
parent40961cda583faaba128b555caebf284fd6298bb1 (diff)
refactor(runtime): use Extensions (#10461)
Diffstat (limited to 'runtime/ops/fs_events.rs')
-rw-r--r--runtime/ops/fs_events.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/runtime/ops/fs_events.rs b/runtime/ops/fs_events.rs
index 8bc9c4c57..6212080b0 100644
--- a/runtime/ops/fs_events.rs
+++ b/runtime/ops/fs_events.rs
@@ -12,6 +12,9 @@ use deno_core::Resource;
use deno_core::ResourceId;
use deno_core::ZeroCopyBuf;
+use deno_core::op_async;
+use deno_core::op_sync;
+use deno_core::Extension;
use notify::event::Event as NotifyEvent;
use notify::Error as NotifyError;
use notify::EventKind;
@@ -27,9 +30,13 @@ use std::path::PathBuf;
use std::rc::Rc;
use tokio::sync::mpsc;
-pub fn init(rt: &mut deno_core::JsRuntime) {
- super::reg_sync(rt, "op_fs_events_open", op_fs_events_open);
- super::reg_async(rt, "op_fs_events_poll", op_fs_events_poll);
+pub fn init() -> Extension {
+ Extension::builder()
+ .ops(vec![
+ ("op_fs_events_open", op_sync(op_fs_events_open)),
+ ("op_fs_events_poll", op_async(op_fs_events_poll)),
+ ])
+ .build()
}
struct FsEventsResource {