js-sys: Expose bindings to WebAssembly.Table.prototype.set

Part of #275
This commit is contained in:
Nick Fitzgerald
2018-09-06 15:02:01 -07:00
parent 8dbb0fc5f2
commit bfff31fcb9
2 changed files with 10 additions and 0 deletions

View File

@ -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<u32, JsValue>;
/// 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

View File

@ -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]