wasm-bindgen
wasm-bindgen copied to clipboard
Facilitating high-level interactions between Wasm modules and JavaScript
I added type annotations to a few commonly-used JS glue code functions. This makes it a lot easier to understand the glue, because I have TS to help me out....
### To reproduce 1. Run `wasm_bindgen --target web` on the wasm produced from the following library: ```rust use wasm_bindgen::prelude::*; #[wasm_bindgen] pub enum Hand { Left = "Left", Right = "Right",...
### Describe the Bug When using the `js_name` on an `enum`, a method does not get exported. ### Steps to Reproduce Consider this snippet: ```rust #[wasm_bindgen(js_name = Data)] pub struct...
### Motivation Certain JS protocols require symbols to identify a certain method or field. E.g. for #4142, we need to use [`Symbol.iterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/iterator) to define an iterable object. ### Proposed Solution...
### Motivation Right now, returning Rust iterators is a pain. While collecting everything into a vec (so the JS side can get an `Array`) can work for some scenarios, this...
### Describe the Bug When I run `wasm-pack build --target web --release` build fails if I use an Array method like `filter` or `map` (I havn't tried other methods). The...
### Motivation `js_sys::Promise` -> `js_sys::Promise` Better type system has obvious benefits. ### Proposed Solution 1. Add a generic to the `js_sys::Promise` 2. Adjust the calls like `then` to take a...
### Describe the Bug When creating bindings to a function with a `u64` return value, the returned value is assumed to be of type `BigInt` in the generated bindings. It...
All major browsers have supported ES modules in web workers for at least a year now. Firefox was the last one to catch up, it seems, and it added support...
### Summary Why do I need to be an arrow function when calling a javascript function asynchronously? ### Additional Details If you define it in function normally, you will get...