summaryrefslogtreecommitdiff
path: root/core/examples/hello_world.rs
diff options
context:
space:
mode:
authorAaron O'Mullan <aaron.omullan@gmail.com>2021-04-25 22:00:05 +0200
committerGitHub <noreply@github.com>2021-04-25 22:00:05 +0200
commit83bece56b01f6997cb71e9289a4d83a398cde0c8 (patch)
tree6f688f86bffd3ada71f7afa67d27a812d0bae386 /core/examples/hello_world.rs
parent1c7164257d146c279b61708ddf8514d85b5fc11c (diff)
refactor(core): move op cache sync responsibility to rust space (#10340)
Even if bootstrapping the JS runtime is low level, it's an abstraction leak of core to require users to call `Deno.core.ops()` in JS space. So instead we're introducing a `JsRuntime::sync_ops_cache()` method, once we have runtime extensions a new runtime will ensure the ops cache is setup (for the provided extensions) and then loading/unloading plugins should be the only operations that require op cache syncs
Diffstat (limited to 'core/examples/hello_world.rs')
-rw-r--r--core/examples/hello_world.rs7
1 files changed, 2 insertions, 5 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) {