diff --git a/crates/js-sys/src/lib.rs b/crates/js-sys/src/lib.rs index d6c746f6..6f9bc275 100644 --- a/crates/js-sys/src/lib.rs +++ b/crates/js-sys/src/lib.rs @@ -3076,6 +3076,13 @@ pub mod WebAssembly { /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Table/grow) #[wasm_bindgen(method, catch, js_namespace = WebAssembly)] pub fn grow(this: &Table, additional_capacity: u32) -> Result; + + /// The `set()` prototype method of the `WebAssembly.Table` object mutates a + /// reference stored at a given index to a different value. + /// + /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Table/set) + #[wasm_bindgen(method, catch, js_namespace = WebAssembly)] + pub fn set(this: &Table, index: u32, function: &Function) -> Result<(), JsValue>; } // WebAssembly.Memory diff --git a/crates/js-sys/tests/wasm/WebAssembly.rs b/crates/js-sys/tests/wasm/WebAssembly.rs index 230a4bfc..65385ec5 100644 --- a/crates/js-sys/tests/wasm/WebAssembly.rs +++ b/crates/js-sys/tests/wasm/WebAssembly.rs @@ -133,6 +133,9 @@ fn table() { table.grow(1).unwrap(); assert_eq!(table.length(), 2); + + let f = table.get(0).unwrap(); + table.set(1, &f).unwrap(); } #[wasm_bindgen_test]