Skip to main content

All Questions

Filter by
Sorted by
Tagged with
2 votes
1 answer
157 views

Rust WASM code stalls on awaiting web_sys::Window.fetch_with_request

I am trying to use the Fetch API using web_sys in Rust WASM code. I have defined an async function: #[wasm_bindgen] pub async fn fetch_as_vec_u8(resource_name: &str) -> Result<Vec<u8>, ...
Vasili Korol's user avatar
1 vote
1 answer
437 views

No click method defined on element when created via web_sys

In the JavaScript console, I can execute the following to create an <input> element and demonstrate that it has a click method. let input = document.createElement("input"); input.type =...
Huckle's user avatar
  • 1,950
-1 votes
1 answer
534 views

How to add an event listener to some HTML element from Rust which calls a trivial JS function?

I have the "on_event" JS function: function on_event(event) { console.log(event); } And I have the "button" HTML element builder in Rust: let window = web_sys::window().expect(...
Nick Nizovtsev's user avatar
2 votes
1 answer
3k views

How to make POST request with JSON body using web-sys in WebAssembly?

How to create POST request with JSON body using web-sys in WebAssembly? This example below showing how to make GET request, I need to change opts.method("GET"); to opts.method("POST&...
obei's user avatar
  • 255