Skip to content

Commit

Permalink
Fix warnings and update web-sys
Browse files Browse the repository at this point in the history
  • Loading branch information
chemicstry committed Oct 23, 2024
1 parent 7279dec commit 5053ae5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
20 changes: 10 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ default = ["es_modules"]
es_modules = []

[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen = "0.2"
web-sys = { version = "0.3", features = [
wasm-bindgen = "0.2.95"
web-sys = { version = "0.3.72", features = [
"Blob",
"DedicatedWorkerGlobalScope",
"MessageEvent",
Expand All @@ -30,18 +30,18 @@ web-sys = { version = "0.3", features = [
"Navigator",
"WorkerNavigator",
] }
js-sys = "0.3"
futures = "0.3"
js-sys = "0.3.72"
futures = "0.3.31"

[dev-dependencies]
log = "0.4"
env_logger = "0.11"
log = "0.4.22"
env_logger = "0.11.5"

[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
console_log = { version = "1.0", features = ["color"] }
console_error_panic_hook = "0.1"
wasm-bindgen-test = "0.3"
async-channel = "2.2"
console_log = { version = "1.0.0", features = ["color"] }
console_error_panic_hook = "0.1.7"
wasm-bindgen-test = "0.3.45"
async-channel = "2.3.1"

[package.metadata.docs.rs]
targets = ["wasm32-unknown-unknown"]
14 changes: 7 additions & 7 deletions src/wasm32/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
pub use std::thread::{current, sleep, Result, Thread, ThreadId};
use std::{
cell::UnsafeCell,
fmt,
Expand All @@ -7,6 +6,7 @@ use std::{
panic::{catch_unwind, AssertUnwindSafe},
rc::Rc,
sync::{Arc, Mutex},
thread::{Result, Thread},
};

use scoped::ScopeData;
Expand Down Expand Up @@ -280,29 +280,29 @@ impl Builder {
let script = worker_script_url.unwrap_or(get_worker_script(wasm_bindgen_shim_url));

// Todo: figure out how to set stack size
let mut options = WorkerOptions::new();
let options = WorkerOptions::new();
match (name, prefix) {
(Some(name), Some(prefix)) => {
options.name(&format!("{}:{}", prefix, name));
options.set_name(&format!("{}:{}", prefix, name));
}
(Some(name), None) => {
options.name(&name);
options.set_name(&name);
}
(None, Some(prefix)) => {
let random = (js_sys::Math::random() * 10e10) as u64;
options.name(&format!("{}:{}", prefix, random));
options.set_name(&format!("{}:{}", prefix, random));
}
(None, None) => {}
};

#[cfg(feature = "es_modules")]
{
js_sys::eval(include_str!("js/module_workers_polyfill.min.js")).unwrap();
options.type_(WorkerType::Module);
options.set_type(WorkerType::Module);
}
#[cfg(not(feature = "es_modules"))]
{
options.type_(WorkerType::Classic);
options.set_type(WorkerType::Classic);
}

// Spawn the worker
Expand Down

0 comments on commit 5053ae5

Please sign in to comment.