Skip to content

Commit 555aa21

Browse files
bircni486c
authored andcommitted
Update web-sys & wasm-bindgen (emilk#4980)
This PR updates web-sys & wasm to the newest version. (this was already part of the POC emilk#4954 ) * Closes <emilk#4961> * Closes <emilk#4958> * [x] I have followed the instructions in the PR template
1 parent 8051b9f commit 555aa21

File tree

7 files changed

+28
-36
lines changed

7 files changed

+28
-36
lines changed

.github/workflows/rust.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ jobs:
108108
- name: wasm-bindgen
109109
uses: jetli/wasm-bindgen-action@v0.1.0
110110
with:
111-
version: "0.2.92"
111+
version: "0.2.93"
112112

113113
- run: ./scripts/wasm_bindgen_check.sh --skip-setup
114114

Cargo.lock

+15-14
Original file line numberDiff line numberDiff line change
@@ -2235,9 +2235,9 @@ dependencies = [
22352235

22362236
[[package]]
22372237
name = "js-sys"
2238-
version = "0.3.69"
2238+
version = "0.3.70"
22392239
source = "registry+https://github.com/rust-lang/crates.io-index"
2240-
checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d"
2240+
checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a"
22412241
dependencies = [
22422242
"wasm-bindgen",
22432243
]
@@ -4208,19 +4208,20 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
42084208

42094209
[[package]]
42104210
name = "wasm-bindgen"
4211-
version = "0.2.92"
4211+
version = "0.2.93"
42124212
source = "registry+https://github.com/rust-lang/crates.io-index"
4213-
checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8"
4213+
checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5"
42144214
dependencies = [
42154215
"cfg-if",
4216+
"once_cell",
42164217
"wasm-bindgen-macro",
42174218
]
42184219

42194220
[[package]]
42204221
name = "wasm-bindgen-backend"
4221-
version = "0.2.92"
4222+
version = "0.2.93"
42224223
source = "registry+https://github.com/rust-lang/crates.io-index"
4223-
checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da"
4224+
checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b"
42244225
dependencies = [
42254226
"bumpalo",
42264227
"log",
@@ -4245,19 +4246,19 @@ dependencies = [
42454246

42464247
[[package]]
42474248
name = "wasm-bindgen-macro"
4248-
version = "0.2.92"
4249+
version = "0.2.93"
42494250
source = "registry+https://github.com/rust-lang/crates.io-index"
4250-
checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726"
4251+
checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf"
42514252
dependencies = [
42524253
"quote",
42534254
"wasm-bindgen-macro-support",
42544255
]
42554256

42564257
[[package]]
42574258
name = "wasm-bindgen-macro-support"
4258-
version = "0.2.92"
4259+
version = "0.2.93"
42594260
source = "registry+https://github.com/rust-lang/crates.io-index"
4260-
checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
4261+
checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836"
42614262
dependencies = [
42624263
"proc-macro2",
42634264
"quote",
@@ -4268,9 +4269,9 @@ dependencies = [
42684269

42694270
[[package]]
42704271
name = "wasm-bindgen-shared"
4271-
version = "0.2.92"
4272+
version = "0.2.93"
42724273
source = "registry+https://github.com/rust-lang/crates.io-index"
4273-
checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96"
4274+
checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484"
42744275

42754276
[[package]]
42764277
name = "wayland-backend"
@@ -4383,9 +4384,9 @@ dependencies = [
43834384

43844385
[[package]]
43854386
name = "web-sys"
4386-
version = "0.3.69"
4387+
version = "0.3.70"
43874388
source = "registry+https://github.com/rust-lang/crates.io-index"
4388-
checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef"
4389+
checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0"
43894390
dependencies = [
43904391
"js-sys",
43914392
"wasm-bindgen",

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ thiserror = "1.0.37"
9090
web-time = "1.1.0" # Timekeeping for native and web
9191
wasm-bindgen = "0.2"
9292
wasm-bindgen-futures = "0.4"
93-
web-sys = "0.3.58"
93+
web-sys = "0.3.70"
9494
wgpu = { version = "22.1.0", default-features = false, features = [
9595
# Make the renderer `Sync` even on wasm32, because it makes the code simpler:
9696
"fragile-send-sync-non-atomic-wasm",

crates/eframe/src/web/events.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -767,8 +767,8 @@ pub(crate) fn install_resize_observer(runner_ref: &WebRunner) -> Result<(), JsVa
767767
}) as Box<dyn FnMut(js_sys::Array)>);
768768

769769
let observer = web_sys::ResizeObserver::new(closure.as_ref().unchecked_ref())?;
770-
let mut options = web_sys::ResizeObserverOptions::new();
771-
options.box_(web_sys::ResizeObserverBoxOptions::ContentBox);
770+
let options = web_sys::ResizeObserverOptions::new();
771+
options.set_box(web_sys::ResizeObserverBoxOptions::ContentBox);
772772
if let Some(runner_lock) = runner_ref.try_lock() {
773773
observer.observe_with_options(runner_lock.canvas(), &options);
774774
drop(runner_lock);

crates/eframe/src/web/mod.rs

+7-16
Original file line numberDiff line numberDiff line change
@@ -171,23 +171,14 @@ fn set_cursor_icon(cursor: egui::CursorIcon) -> Option<()> {
171171
#[cfg(web_sys_unstable_apis)]
172172
fn set_clipboard_text(s: &str) {
173173
if let Some(window) = web_sys::window() {
174-
if let Some(clipboard) = window.navigator().clipboard() {
175-
let promise = clipboard.write_text(s);
176-
let future = wasm_bindgen_futures::JsFuture::from(promise);
177-
let future = async move {
178-
if let Err(err) = future.await {
179-
log::error!("Copy/cut action failed: {}", string_from_js_value(&err));
180-
}
181-
};
182-
wasm_bindgen_futures::spawn_local(future);
183-
} else {
184-
let is_secure_context = window.is_secure_context();
185-
if is_secure_context {
186-
log::warn!("window.navigator.clipboard is null; can't copy text");
187-
} else {
188-
log::warn!("window.navigator.clipboard is null; can't copy text, probably because we're not in a secure context. See https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts");
174+
let promise = window.navigator().clipboard().write_text(s);
175+
let future = wasm_bindgen_futures::JsFuture::from(promise);
176+
let future = async move {
177+
if let Err(err) = future.await {
178+
log::error!("Copy/cut action failed: {}", string_from_js_value(&err));
189179
}
190-
}
180+
};
181+
wasm_bindgen_futures::spawn_local(future);
191182
}
192183
}
193184

crates/egui_demo_app/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,6 @@ rfd = { version = "0.13", optional = true }
7777

7878
# web:
7979
[target.'cfg(target_arch = "wasm32")'.dependencies]
80-
wasm-bindgen = "=0.2.92"
80+
wasm-bindgen = "=0.2.93"
8181
wasm-bindgen-futures.workspace = true
8282
web-sys.workspace = true

scripts/setup_web.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ cd "$script_path/.."
77
rustup target add wasm32-unknown-unknown
88

99
# For generating JS bindings:
10-
cargo install --quiet wasm-bindgen-cli --version 0.2.92
10+
cargo install --quiet wasm-bindgen-cli --version 0.2.93

0 commit comments

Comments
 (0)