diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-12-13 19:45:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-13 19:45:53 +0100 |
commit | 2e74f164b6dcf0ecbf8dd38fba9fae550d784bd0 (patch) | |
tree | 61abe8e09d5331ace5d9de529f0e2737a8e05dbb /cli/ops/web_worker.rs | |
parent | 84ef9bd21fb48fb6b5fbc8dafc3de9f361bade3b (diff) |
refactor: deno_runtime crate (#8640)
This commit moves Deno JS runtime, ops, permissions and
inspector implementation to new "deno_runtime" crate located
in "runtime/" directory.
Details in "runtime/README.md".
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
Diffstat (limited to 'cli/ops/web_worker.rs')
-rw-r--r-- | cli/ops/web_worker.rs | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/cli/ops/web_worker.rs b/cli/ops/web_worker.rs deleted file mode 100644 index d88330a04..000000000 --- a/cli/ops/web_worker.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. - -use crate::web_worker::WebWorkerHandle; -use crate::web_worker::WorkerEvent; -use deno_core::futures::channel::mpsc; -use deno_core::serde_json::json; - -pub fn init( - rt: &mut deno_core::JsRuntime, - sender: mpsc::Sender<WorkerEvent>, - handle: WebWorkerHandle, -) { - // Post message to host as guest worker. - let sender_ = sender.clone(); - super::reg_json_sync( - rt, - "op_worker_post_message", - move |_state, _args, bufs| { - assert_eq!(bufs.len(), 1, "Invalid number of arguments"); - let msg_buf: Box<[u8]> = (*bufs[0]).into(); - sender_ - .clone() - .try_send(WorkerEvent::Message(msg_buf)) - .expect("Failed to post message to host"); - Ok(json!({})) - }, - ); - - // Notify host that guest worker closes. - super::reg_json_sync(rt, "op_worker_close", move |_state, _args, _bufs| { - // Notify parent that we're finished - sender.clone().close_channel(); - // Terminate execution of current worker - handle.terminate(); - Ok(json!({})) - }); -} |