summaryrefslogtreecommitdiff
path: root/core/examples
diff options
context:
space:
mode:
Diffstat (limited to 'core/examples')
-rw-r--r--core/examples/hello_world.rs7
-rw-r--r--core/examples/http_bench_json_ops.js2
-rw-r--r--core/examples/http_bench_json_ops.rs1
3 files changed, 3 insertions, 7 deletions
diff --git a/core/examples/hello_world.rs b/core/examples/hello_world.rs
index 62d268340..a9d2934f6 100644
--- a/core/examples/hello_world.rs
+++ b/core/examples/hello_world.rs
@@ -56,6 +56,7 @@ fn main() {
Ok(sum)
}),
);
+ runtime.sync_ops_cache();
// Now we see how to invoke the ops we just defined. The runtime automatically
// contains a Deno.core object with several functions for interacting with it.
@@ -64,11 +65,7 @@ fn main() {
.execute(
"<init>",
r#"
-// First we initialize the ops cache.
-// This maps op names to their id's.
-Deno.core.ops();
-
-// Then we define a print function that uses
+// Define a print function that uses
// our op_print op to display the stringified argument.
const _newline = new Uint8Array([10]);
function print(value) {
diff --git a/core/examples/http_bench_json_ops.js b/core/examples/http_bench_json_ops.js
index 672747196..ad36dd674 100644
--- a/core/examples/http_bench_json_ops.js
+++ b/core/examples/http_bench_json_ops.js
@@ -54,8 +54,6 @@ async function serve(rid) {
}
async function main() {
- Deno.core.ops();
-
const listenerRid = listen();
Deno.core.print(`http_bench_ops listening on http://127.0.0.1:4544/\n`);
diff --git a/core/examples/http_bench_json_ops.rs b/core/examples/http_bench_json_ops.rs
index e1b435e4c..f891caa9e 100644
--- a/core/examples/http_bench_json_ops.rs
+++ b/core/examples/http_bench_json_ops.rs
@@ -116,6 +116,7 @@ fn create_js_runtime() -> JsRuntime {
runtime.register_op("accept", deno_core::op_async(op_accept));
runtime.register_op("read", deno_core::op_async(op_read));
runtime.register_op("write", deno_core::op_async(op_write));
+ runtime.sync_ops_cache();
runtime
}