diff options
author | Matt Mastracci <matthew@mastracci.com> | 2023-07-01 18:00:14 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-02 00:00:14 +0000 |
commit | e746b6d80654ba4e4e26370fe6e4f784ce841d92 (patch) | |
tree | 153ffad92a96126b9ab8e906dcdabf7648755931 /core/examples/disable_ops.rs | |
parent | b9c0e7cd550ab14fa7da7e33ed87cbeeeb9785a0 (diff) |
refactor(core): Extract deno_core (#19658)
`deno_core` is moving out! You'll find it at
https://github.com/denoland/deno_core/ once this PR lands.
Diffstat (limited to 'core/examples/disable_ops.rs')
-rw-r--r-- | core/examples/disable_ops.rs | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/core/examples/disable_ops.rs b/core/examples/disable_ops.rs deleted file mode 100644 index c75af1c3f..000000000 --- a/core/examples/disable_ops.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. -//! This example shows you how to define ops in Rust and then call them from -//! JavaScript. - -use deno_core::Extension; -use deno_core::JsRuntime; -use deno_core::RuntimeOptions; - -fn main() { - let my_ext = Extension::builder("my_ext") - .middleware(|op| match op.name { - "op_print" => op.disable(), - _ => op, - }) - .build(); - - // Initialize a runtime instance - let mut runtime = JsRuntime::new(RuntimeOptions { - extensions: vec![my_ext], - ..Default::default() - }); - - // Deno.core.print() will now be a NOP - runtime - .execute_script_static("<usage>", r#"Deno.core.print("I'm broken")"#) - .unwrap(); -} |