summaryrefslogtreecommitdiff
path: root/runtime/examples
diff options
context:
space:
mode:
authorAaron O'Mullan <aaron.omullan@gmail.com>2021-10-05 22:41:14 +0200
committerGitHub <noreply@github.com>2021-10-05 22:41:14 +0200
commit678a881f63ee8e3b86d4dc539234a78c94cc9c1e (patch)
tree312c72895dca58d360e5d932e72f47f0fcb54be9 /runtime/examples
parent77a00ce1fb4ae2523e22b9b84ae09a0200502e38 (diff)
refactor(runtime): Worker bootstrap options (#12299)
Diffstat (limited to 'runtime/examples')
-rw-r--r--runtime/examples/hello_runtime.rs31
1 files changed, 18 insertions, 13 deletions
diff --git a/runtime/examples/hello_runtime.rs b/runtime/examples/hello_runtime.rs
index eb6b5a591..eb4557c04 100644
--- a/runtime/examples/hello_runtime.rs
+++ b/runtime/examples/hello_runtime.rs
@@ -7,6 +7,7 @@ use deno_runtime::deno_web::BlobStore;
use deno_runtime::permissions::Permissions;
use deno_runtime::worker::MainWorker;
use deno_runtime::worker::WorkerOptions;
+use deno_runtime::BootstrapOptions;
use std::path::Path;
use std::rc::Rc;
use std::sync::Arc;
@@ -23,11 +24,18 @@ async fn main() -> Result<(), AnyError> {
});
let options = WorkerOptions {
- apply_source_maps: false,
- args: vec![],
- debug_flag: false,
- unstable: false,
- enable_testing_features: false,
+ bootstrap: BootstrapOptions {
+ apply_source_maps: false,
+ args: vec![],
+ cpu_count: 1,
+ debug_flag: false,
+ enable_testing_features: false,
+ location: None,
+ no_color: false,
+ runtime_version: "x".to_string(),
+ ts_version: "x".to_string(),
+ unstable: false,
+ },
unsafely_ignore_certificate_errors: None,
root_cert_store: None,
user_agent: "hello_runtime".to_string(),
@@ -37,17 +45,12 @@ async fn main() -> Result<(), AnyError> {
maybe_inspector_server: None,
should_break_on_first_statement: false,
module_loader,
- runtime_version: "x".to_string(),
- ts_version: "x".to_string(),
- no_color: false,
get_error_class_fn: Some(&get_error_class_name),
- location: None,
origin_storage_dir: None,
blob_store: BlobStore::default(),
broadcast_channel: InMemoryBroadcastChannel::default(),
shared_array_buffer_store: None,
compiled_wasm_module_store: None,
- cpu_count: 1,
};
let js_path =
@@ -55,9 +58,11 @@ async fn main() -> Result<(), AnyError> {
let main_module = deno_core::resolve_path(&js_path.to_string_lossy())?;
let permissions = Permissions::allow_all();
- let mut worker =
- MainWorker::from_options(main_module.clone(), permissions, &options);
- worker.bootstrap(&options);
+ let mut worker = MainWorker::bootstrap_from_options(
+ main_module.clone(),
+ permissions,
+ options,
+ );
worker.execute_main_module(&main_module).await?;
worker.run_event_loop(false).await?;
Ok(())