Registry / networking / web-sys

web-sys

JSON →
library0.3.102rscratesunverified

Provides bindings to all Web APIs, generated from WebIDL for use with wasm-bindgen.

# Cargo.toml [dependencies] web-sys = "0.3.102"
INSTALL
IMPORT
SIG · WEB-SYS
W
web-sys
networkingrustv0.3.102
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

window
use web_sys::window;

Shows a browser alert using the Web API via web-sys.

use wasm_bindgen::prelude::*; use web_sys::window; #[wasm_bindgen] pub fn alert_message() { let window = window().unwrap(); window.alert_with_message("Hello from WebAssembly!").unwrap(); }
Debug
Known issues
gotchaRequires wasm-bindgen and target wasm32-unknown-unknown.
fix
Add wasm-bindgen dependency and compile with --target wasm32-unknown-unknown.
affects: >=0.3.0
Upgrade
Version history
0.3.102latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
17 hits · last 30 days
node
14
Amazon
1
OpenAI (training)
1
Resources
web-sys — cargo add web-sys · libregistry