diff options
Diffstat (limited to 'vendor/js-sys/src')
-rw-r--r-- | vendor/js-sys/src/lib.rs | 151 |
1 files changed, 143 insertions, 8 deletions
diff --git a/vendor/js-sys/src/lib.rs b/vendor/js-sys/src/lib.rs index 576aec1f0..b18faf6ca 100644 --- a/vendor/js-sys/src/lib.rs +++ b/vendor/js-sys/src/lib.rs @@ -28,6 +28,7 @@ use std::mem; use std::str; use std::str::FromStr; +pub use wasm_bindgen; use wasm_bindgen::prelude::*; // When adding new imports: @@ -1147,32 +1148,32 @@ pub mod Atomics { /// Note: This operation only works with a shared `Int32Array` /// and may not be allowed on the main thread. /// - /// You should use `wait_bigint` to operate on a `BigInt64Array` or a `BigUint64Array`. + /// You should use `wait_bigint` to operate on a `BigInt64Array`. /// /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/wait) #[wasm_bindgen(js_namespace = Atomics, catch)] pub fn wait(typed_array: &Int32Array, index: u32, value: i32) -> Result<JsString, JsValue>; /// The static `Atomics.wait()` method verifies that a given - /// position in an `Int32Array` still contains a given value + /// position in an `BigInt64Array` still contains a given value /// and if so sleeps, awaiting a wakeup or a timeout. /// It returns a string which is either "ok", "not-equal", or "timed-out". - /// Note: This operation only works with a shared `Int32Array` + /// Note: This operation only works with a shared `BigInt64Array` /// and may not be allowed on the main thread. /// - /// This method is used to operate on a `BigInt64Array` or a `BigUint64Array`. + /// You should use `wait` to operate on a `Int32Array`. /// /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/wait) #[wasm_bindgen(js_namespace = Atomics, catch, js_name = wait)] pub fn wait_bigint( - typed_array: &Int32Array, + typed_array: &BigInt64Array, index: u32, value: i64, ) -> Result<JsString, JsValue>; /// Like `wait()`, but with timeout /// - /// You should use `wait_with_timeout_bigint` to operate on a `BigInt64Array` or a `BigUint64Array`. + /// You should use `wait_with_timeout_bigint` to operate on a `BigInt64Array`. /// /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/wait) #[wasm_bindgen(js_namespace = Atomics, catch, js_name = wait)] @@ -1185,17 +1186,81 @@ pub mod Atomics { /// Like `wait()`, but with timeout /// - /// This method is used to operate on a `BigInt64Array` or a `BigUint64Array`. + /// You should use `wait_with_timeout` to operate on a `Int32Array`. /// /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/wait) #[wasm_bindgen(js_namespace = Atomics, catch, js_name = wait)] pub fn wait_with_timeout_bigint( - typed_array: &Int32Array, + typed_array: &BigInt64Array, index: u32, value: i64, timeout: f64, ) -> Result<JsString, JsValue>; + /// The static `Atomics.waitAsync()` method verifies that a given position in an + /// `Int32Array` still contains a given value and if so sleeps, awaiting a + /// wakeup or a timeout. It returns an object with two properties. The first + /// property `async` is a boolean which if true indicates that the second + /// property `value` is a promise. If `async` is false then value is a string + /// whether equal to either "not-equal" or "timed-out". + /// Note: This operation only works with a shared `Int32Array` and may be used + /// on the main thread. + /// + /// You should use `wait_async_bigint` to operate on a `BigInt64Array`. + /// + /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/waitAsync) + #[wasm_bindgen(js_namespace = Atomics, catch, js_name = waitAsync)] + pub fn wait_async( + typed_array: &Int32Array, + index: u32, + value: i32, + ) -> Result<Object, JsValue>; + + /// The static `Atomics.waitAsync()` method verifies that a given position in an + /// `Int32Array` still contains a given value and if so sleeps, awaiting a + /// wakeup or a timeout. It returns an object with two properties. The first + /// property `async` is a boolean which if true indicates that the second + /// property `value` is a promise. If `async` is false then value is a string + /// whether equal to either "not-equal" or "timed-out". + /// Note: This operation only works with a shared `BigInt64Array` and may be used + /// on the main thread. + /// + /// You should use `wait_async` to operate on a `Int32Array`. + /// + /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/waitAsync) + #[wasm_bindgen(js_namespace = Atomics, catch, js_name = waitAsync)] + pub fn wait_async_bigint( + typed_array: &BigInt64Array, + index: u32, + value: i64, + ) -> Result<Object, JsValue>; + + /// Like `waitAsync()`, but with timeout + /// + /// You should use `wait_async_with_timeout_bigint` to operate on a `BigInt64Array`. + /// + /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/waitAsync) + #[wasm_bindgen(js_namespace = Atomics, catch, js_name = waitAsync)] + pub fn wait_async_with_timeout( + typed_array: &Int32Array, + index: u32, + value: i32, + timeout: f64, + ) -> Result<Object, JsValue>; + + /// Like `waitAsync()`, but with timeout + /// + /// You should use `wait_async_with_timeout` to operate on a `Int32Array`. + /// + /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/waitAsync) + #[wasm_bindgen(js_namespace = Atomics, catch, js_name = waitAsync)] + pub fn wait_async_with_timeout_bigint( + typed_array: &BigInt64Array, + index: u32, + value: i64, + timeout: f64, + ) -> Result<Object, JsValue>; + /// The static `Atomics.xor()` method computes a bitwise XOR /// with a given value at a given position in the array, /// and returns the old value at that position. @@ -1533,6 +1598,18 @@ extern "C" { #[wasm_bindgen(constructor)] pub fn new(buffer: &ArrayBuffer, byteOffset: usize, byteLength: usize) -> DataView; + /// The `DataView` view provides a low-level interface for reading and + /// writing multiple number types in an `ArrayBuffer` irrespective of the + /// platform's endianness. + /// + /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) + #[wasm_bindgen(constructor)] + pub fn new_with_shared_array_buffer( + buffer: &SharedArrayBuffer, + byteOffset: usize, + byteLength: usize, + ) -> DataView; + /// The ArrayBuffer referenced by this view. Fixed at construction time and thus read only. /// /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView/buffer) @@ -4467,6 +4544,64 @@ pub mod WebAssembly { pub fn set(this: &Table, index: u32, function: &Function) -> Result<(), JsValue>; } + // WebAssembly.Tag + #[wasm_bindgen] + extern "C" { + /// The `WebAssembly.Tag()` constructor creates a new `Tag` object + /// + /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Tag) + #[wasm_bindgen(js_namespace = WebAssembly, extends = Object, typescript_type = "WebAssembly.Tag")] + #[derive(Clone, Debug, PartialEq, Eq)] + pub type Tag; + + /// The `WebAssembly.Tag()` constructor creates a new `Tag` object + /// + /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Tag) + #[wasm_bindgen(constructor, js_namespace = WebAssembly, catch)] + pub fn new(tag_descriptor: &Object) -> Result<Tag, JsValue>; + } + + // WebAssembly.Exception + #[wasm_bindgen] + extern "C" { + /// The `WebAssembly.Exception()` constructor creates a new `Exception` object + /// + /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Exception) + #[wasm_bindgen(js_namespace = WebAssembly, extends = Object, typescript_type = "WebAssembly.Exception")] + #[derive(Clone, Debug, PartialEq, Eq)] + pub type Exception; + + /// The `WebAssembly.Exception()` constructor creates a new `Exception` object + /// + /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Exception) + #[wasm_bindgen(constructor, js_namespace = WebAssembly, catch)] + pub fn new(tag: &Tag, payload: &Array) -> Result<Exception, JsValue>; + + /// The `WebAssembly.Exception()` constructor creates a new `Exception` object + /// + /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Exception) + #[wasm_bindgen(constructor, js_namespace = WebAssembly, catch)] + pub fn new_with_options( + tag: &Tag, + payload: &Array, + options: &Object, + ) -> Result<Exception, JsValue>; + + /// The `is()` prototype method of the `WebAssembly.Exception` can be used to + /// test if the Exception matches a given tag. + /// + /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Exception/is) + #[wasm_bindgen(method, js_namespace = WebAssembly)] + pub fn is(this: &Exception, tag: &Tag) -> bool; + + /// The `getArg()` prototype method of the `WebAssembly.Exception` can be used + /// to get the value of a specified item in the exception's data arguments + /// + /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Exception/getArg) + #[wasm_bindgen(method, js_namespace = WebAssembly, js_name = getArg, catch)] + pub fn get_arg(this: &Exception, tag: &Tag, index: u32) -> Result<JsValue, JsValue>; + } + // WebAssembly.Global #[wasm_bindgen] extern "C" { |