mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-20 08:16:31 +00:00
Merge pull request #1451 from RReverser/more-static-namespaces
Transform Math, Reflect and JSON into static namespaces
This commit is contained in:
@ -1186,18 +1186,18 @@ extern "C" {
|
|||||||
pub fn value(this: &IteratorNext) -> JsValue;
|
pub fn value(this: &IteratorNext) -> JsValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Math
|
#[allow(non_snake_case)]
|
||||||
#[wasm_bindgen]
|
pub mod Math {
|
||||||
extern "C" {
|
use super::*;
|
||||||
#[wasm_bindgen(extends = Object)]
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
||||||
pub type Math;
|
|
||||||
|
|
||||||
|
// Math
|
||||||
|
#[wasm_bindgen]
|
||||||
|
extern "C" {
|
||||||
/// The Math.abs() function returns the absolute value of a number, that is
|
/// The Math.abs() function returns the absolute value of a number, that is
|
||||||
/// Math.abs(x) = |x|
|
/// Math.abs(x) = |x|
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/abs)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/abs)
|
||||||
#[wasm_bindgen(static_method_of = Math)]
|
#[wasm_bindgen(js_namespace = Math)]
|
||||||
pub fn abs(x: f64) -> f64;
|
pub fn abs(x: f64) -> f64;
|
||||||
|
|
||||||
/// The Math.acos() function returns the arccosine (in radians) of a
|
/// The Math.acos() function returns the arccosine (in radians) of a
|
||||||
@ -1205,7 +1205,7 @@ extern "C" {
|
|||||||
/// Math.acos(x) = arccos(x) = the unique y∊[0;π] such that cos(y)=x
|
/// Math.acos(x) = arccos(x) = the unique y∊[0;π] such that cos(y)=x
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/acos)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/acos)
|
||||||
#[wasm_bindgen(static_method_of = Math)]
|
#[wasm_bindgen(js_namespace = Math)]
|
||||||
pub fn acos(x: f64) -> f64;
|
pub fn acos(x: f64) -> f64;
|
||||||
|
|
||||||
/// The Math.acosh() function returns the hyperbolic arc-cosine of a
|
/// The Math.acosh() function returns the hyperbolic arc-cosine of a
|
||||||
@ -1213,7 +1213,7 @@ extern "C" {
|
|||||||
/// Math.acosh(x) = arcosh(x) = the unique y ≥ 0 such that cosh(y) = x
|
/// Math.acosh(x) = arcosh(x) = the unique y ≥ 0 such that cosh(y) = x
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/acosh)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/acosh)
|
||||||
#[wasm_bindgen(static_method_of = Math)]
|
#[wasm_bindgen(js_namespace = Math)]
|
||||||
pub fn acosh(x: f64) -> f64;
|
pub fn acosh(x: f64) -> f64;
|
||||||
|
|
||||||
/// The Math.asin() function returns the arcsine (in radians) of a
|
/// The Math.asin() function returns the arcsine (in radians) of a
|
||||||
@ -1221,27 +1221,27 @@ extern "C" {
|
|||||||
/// Math.asin(x) = arcsin(x) = the unique y∊[-π2;π2] such that sin(y) = x
|
/// Math.asin(x) = arcsin(x) = the unique y∊[-π2;π2] such that sin(y) = x
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/asin)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/asin)
|
||||||
#[wasm_bindgen(static_method_of = Math)]
|
#[wasm_bindgen(js_namespace = Math)]
|
||||||
pub fn asin(x: f64) -> f64;
|
pub fn asin(x: f64) -> f64;
|
||||||
|
|
||||||
/// The Math.asinh() function returns the hyperbolic arcsine of a
|
/// The Math.asinh() function returns the hyperbolic arcsine of a
|
||||||
/// number, that is Math.asinh(x) = arsinh(x) = the unique y such that sinh(y) = x
|
/// number, that is Math.asinh(x) = arsinh(x) = the unique y such that sinh(y) = x
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/asinh)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/asinh)
|
||||||
#[wasm_bindgen(static_method_of = Math)]
|
#[wasm_bindgen(js_namespace = Math)]
|
||||||
pub fn asinh(x: f64) -> f64;
|
pub fn asinh(x: f64) -> f64;
|
||||||
|
|
||||||
/// The Math.atan() function returns the arctangent (in radians) of a
|
/// The Math.atan() function returns the arctangent (in radians) of a
|
||||||
/// number, that is Math.atan(x) = arctan(x) = the unique y ∊ [-π2;π2]such that
|
/// number, that is Math.atan(x) = arctan(x) = the unique y ∊ [-π2;π2]such that
|
||||||
/// tan(y) = x
|
/// tan(y) = x
|
||||||
#[wasm_bindgen(static_method_of = Math)]
|
#[wasm_bindgen(js_namespace = Math)]
|
||||||
pub fn atan(x: f64) -> f64;
|
pub fn atan(x: f64) -> f64;
|
||||||
|
|
||||||
/// The Math.atan2() function returns the arctangent of the quotient of
|
/// The Math.atan2() function returns the arctangent of the quotient of
|
||||||
/// its arguments.
|
/// its arguments.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/atan2)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/atan2)
|
||||||
#[wasm_bindgen(static_method_of = Math)]
|
#[wasm_bindgen(js_namespace = Math)]
|
||||||
pub fn atan2(y: f64, x: f64) -> f64;
|
pub fn atan2(y: f64, x: f64) -> f64;
|
||||||
|
|
||||||
/// The Math.atanh() function returns the hyperbolic arctangent of a number,
|
/// The Math.atanh() function returns the hyperbolic arctangent of a number,
|
||||||
@ -1249,125 +1249,125 @@ extern "C" {
|
|||||||
/// tanh(y) = x
|
/// tanh(y) = x
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/atanh)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/atanh)
|
||||||
#[wasm_bindgen(static_method_of = Math)]
|
#[wasm_bindgen(js_namespace = Math)]
|
||||||
pub fn atanh(x: f64) -> f64;
|
pub fn atanh(x: f64) -> f64;
|
||||||
|
|
||||||
/// The Math.cbrt() function returns the cube root of a number, that is
|
/// The Math.cbrt() function returns the cube root of a number, that is
|
||||||
/// Math.cbrt(x) = x^3 = the unique y such that y^3 = x
|
/// Math.cbrt(x) = x^3 = the unique y such that y^3 = x
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/cbrt)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/cbrt)
|
||||||
#[wasm_bindgen(static_method_of = Math)]
|
#[wasm_bindgen(js_namespace = Math)]
|
||||||
pub fn cbrt(x: f64) -> f64;
|
pub fn cbrt(x: f64) -> f64;
|
||||||
|
|
||||||
/// The Math.ceil() function returns the smallest integer greater than
|
/// The Math.ceil() function returns the smallest integer greater than
|
||||||
/// or equal to a given number.
|
/// or equal to a given number.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/ceil)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/ceil)
|
||||||
#[wasm_bindgen(static_method_of = Math)]
|
#[wasm_bindgen(js_namespace = Math)]
|
||||||
pub fn ceil(x: f64) -> f64;
|
pub fn ceil(x: f64) -> f64;
|
||||||
|
|
||||||
/// The Math.clz32() function returns the number of leading zero bits in
|
/// The Math.clz32() function returns the number of leading zero bits in
|
||||||
/// the 32-bit binary representation of a number.
|
/// the 32-bit binary representation of a number.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/clz32)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/clz32)
|
||||||
#[wasm_bindgen(static_method_of = Math)]
|
#[wasm_bindgen(js_namespace = Math)]
|
||||||
pub fn clz32(x: i32) -> u32;
|
pub fn clz32(x: i32) -> u32;
|
||||||
|
|
||||||
/// The Math.cos() static function returns the cosine of the specified angle,
|
/// The Math.cos() static function returns the cosine of the specified angle,
|
||||||
/// which must be specified in radians. This value is length(adjacent)/length(hypotenuse).
|
/// which must be specified in radians. This value is length(adjacent)/length(hypotenuse).
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/cos)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/cos)
|
||||||
#[wasm_bindgen(static_method_of = Math)]
|
#[wasm_bindgen(js_namespace = Math)]
|
||||||
pub fn cos(x: f64) -> f64;
|
pub fn cos(x: f64) -> f64;
|
||||||
|
|
||||||
/// The Math.cosh() function returns the hyperbolic cosine of a number,
|
/// The Math.cosh() function returns the hyperbolic cosine of a number,
|
||||||
/// that can be expressed using the constant e.
|
/// that can be expressed using the constant e.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/cosh)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/cosh)
|
||||||
#[wasm_bindgen(static_method_of = Math)]
|
#[wasm_bindgen(js_namespace = Math)]
|
||||||
pub fn cosh(x: f64) -> f64;
|
pub fn cosh(x: f64) -> f64;
|
||||||
|
|
||||||
/// The Math.exp() function returns e^x, where x is the argument, and e is Euler's number
|
/// The Math.exp() function returns e^x, where x is the argument, and e is Euler's number
|
||||||
/// (also known as Napier's constant), the base of the natural logarithms.
|
/// (also known as Napier's constant), the base of the natural logarithms.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/exp)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/exp)
|
||||||
#[wasm_bindgen(static_method_of = Math)]
|
#[wasm_bindgen(js_namespace = Math)]
|
||||||
pub fn exp(x: f64) -> f64;
|
pub fn exp(x: f64) -> f64;
|
||||||
|
|
||||||
/// The Math.expm1() function returns e^x - 1, where x is the argument, and e the base of the
|
/// The Math.expm1() function returns e^x - 1, where x is the argument, and e the base of the
|
||||||
/// natural logarithms.
|
/// natural logarithms.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/expm1)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/expm1)
|
||||||
#[wasm_bindgen(static_method_of = Math)]
|
#[wasm_bindgen(js_namespace = Math)]
|
||||||
pub fn expm1(x: f64) -> f64;
|
pub fn expm1(x: f64) -> f64;
|
||||||
|
|
||||||
/// The Math.floor() function returns the largest integer less than or
|
/// The Math.floor() function returns the largest integer less than or
|
||||||
/// equal to a given number.
|
/// equal to a given number.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/floor)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/floor)
|
||||||
#[wasm_bindgen(static_method_of = Math)]
|
#[wasm_bindgen(js_namespace = Math)]
|
||||||
pub fn floor(x: f64) -> f64;
|
pub fn floor(x: f64) -> f64;
|
||||||
|
|
||||||
/// The Math.fround() function returns the nearest 32-bit single precision float representation
|
/// The Math.fround() function returns the nearest 32-bit single precision float representation
|
||||||
/// of a Number.
|
/// of a Number.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/fround)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/fround)
|
||||||
#[wasm_bindgen(static_method_of = Math)]
|
#[wasm_bindgen(js_namespace = Math)]
|
||||||
pub fn fround(x: f64) -> f32;
|
pub fn fround(x: f64) -> f32;
|
||||||
|
|
||||||
/// The Math.hypot() function returns the square root of the sum of squares of its arguments.
|
/// The Math.hypot() function returns the square root of the sum of squares of its arguments.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/hypot)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/hypot)
|
||||||
#[wasm_bindgen(static_method_of = Math)]
|
#[wasm_bindgen(js_namespace = Math)]
|
||||||
pub fn hypot(x: f64, y: f64) -> f64;
|
pub fn hypot(x: f64, y: f64) -> f64;
|
||||||
|
|
||||||
/// The Math.imul() function returns the result of the C-like 32-bit multiplication of the
|
/// The Math.imul() function returns the result of the C-like 32-bit multiplication of the
|
||||||
/// two parameters.
|
/// two parameters.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/imul)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/imul)
|
||||||
#[wasm_bindgen(static_method_of = Math)]
|
#[wasm_bindgen(js_namespace = Math)]
|
||||||
pub fn imul(x: i32, y: i32) -> i32;
|
pub fn imul(x: i32, y: i32) -> i32;
|
||||||
|
|
||||||
/// The Math.log() function returns the natural logarithm (base e) of a number.
|
/// The Math.log() function returns the natural logarithm (base e) of a number.
|
||||||
/// The JavaScript Math.log() function is equivalent to ln(x) in mathematics.
|
/// The JavaScript Math.log() function is equivalent to ln(x) in mathematics.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log)
|
||||||
#[wasm_bindgen(static_method_of = Math)]
|
#[wasm_bindgen(js_namespace = Math)]
|
||||||
pub fn log(x: f64) -> f64;
|
pub fn log(x: f64) -> f64;
|
||||||
|
|
||||||
/// The Math.log10() function returns the base 10 logarithm of a number.
|
/// The Math.log10() function returns the base 10 logarithm of a number.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log10)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log10)
|
||||||
#[wasm_bindgen(static_method_of = Math)]
|
#[wasm_bindgen(js_namespace = Math)]
|
||||||
pub fn log10(x: f64) -> f64;
|
pub fn log10(x: f64) -> f64;
|
||||||
|
|
||||||
/// The Math.log1p() function returns the natural logarithm (base e) of 1 + a number.
|
/// The Math.log1p() function returns the natural logarithm (base e) of 1 + a number.
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log1p)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log1p)
|
||||||
#[wasm_bindgen(static_method_of = Math)]
|
#[wasm_bindgen(js_namespace = Math)]
|
||||||
pub fn log1p(x: f64) -> f64;
|
pub fn log1p(x: f64) -> f64;
|
||||||
|
|
||||||
/// The Math.log2() function returns the base 2 logarithm of a number.
|
/// The Math.log2() function returns the base 2 logarithm of a number.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log2)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log2)
|
||||||
#[wasm_bindgen(static_method_of = Math)]
|
#[wasm_bindgen(js_namespace = Math)]
|
||||||
pub fn log2(x: f64) -> f64;
|
pub fn log2(x: f64) -> f64;
|
||||||
|
|
||||||
/// The Math.max() function returns the largest of two numbers.
|
/// The Math.max() function returns the largest of two numbers.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/max)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/max)
|
||||||
#[wasm_bindgen(static_method_of = Math)]
|
#[wasm_bindgen(js_namespace = Math)]
|
||||||
pub fn max(x: f64, y: f64) -> f64;
|
pub fn max(x: f64, y: f64) -> f64;
|
||||||
|
|
||||||
/// The static function Math.min() returns the lowest-valued number passed into it.
|
/// The static function Math.min() returns the lowest-valued number passed into it.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/min)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/min)
|
||||||
#[wasm_bindgen(static_method_of = Math)]
|
#[wasm_bindgen(js_namespace = Math)]
|
||||||
pub fn min(x: f64, y: f64) -> f64;
|
pub fn min(x: f64, y: f64) -> f64;
|
||||||
|
|
||||||
/// The Math.pow() function returns the base to the exponent power, that is, base^exponent.
|
/// The Math.pow() function returns the base to the exponent power, that is, base^exponent.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/pow)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/pow)
|
||||||
#[wasm_bindgen(static_method_of = Math)]
|
#[wasm_bindgen(js_namespace = Math)]
|
||||||
pub fn pow(base: f64, exponent: f64) -> f64;
|
pub fn pow(base: f64, exponent: f64) -> f64;
|
||||||
|
|
||||||
/// The Math.random() function returns a floating-point, pseudo-random number
|
/// The Math.random() function returns a floating-point, pseudo-random number
|
||||||
@ -1377,61 +1377,62 @@ extern "C" {
|
|||||||
/// it cannot be chosen or reset by the user.
|
/// it cannot be chosen or reset by the user.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random)
|
||||||
#[wasm_bindgen(static_method_of = Math)]
|
#[wasm_bindgen(js_namespace = Math)]
|
||||||
pub fn random() -> f64;
|
pub fn random() -> f64;
|
||||||
|
|
||||||
/// The Math.round() function returns the value of a number rounded to the nearest integer.
|
/// The Math.round() function returns the value of a number rounded to the nearest integer.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/round)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/round)
|
||||||
#[wasm_bindgen(static_method_of = Math)]
|
#[wasm_bindgen(js_namespace = Math)]
|
||||||
pub fn round(x: f64) -> f64;
|
pub fn round(x: f64) -> f64;
|
||||||
|
|
||||||
/// The Math.sign() function returns the sign of a number, indicating whether the number is
|
/// The Math.sign() function returns the sign of a number, indicating whether the number is
|
||||||
/// positive, negative or zero.
|
/// positive, negative or zero.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign)
|
||||||
#[wasm_bindgen(static_method_of = Math)]
|
#[wasm_bindgen(js_namespace = Math)]
|
||||||
pub fn sign(x: f64) -> f64;
|
pub fn sign(x: f64) -> f64;
|
||||||
|
|
||||||
/// The Math.sin() function returns the sine of a number.
|
/// The Math.sin() function returns the sine of a number.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sin)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sin)
|
||||||
#[wasm_bindgen(static_method_of = Math)]
|
#[wasm_bindgen(js_namespace = Math)]
|
||||||
pub fn sin(x: f64) -> f64;
|
pub fn sin(x: f64) -> f64;
|
||||||
|
|
||||||
/// The Math.sinh() function returns the hyperbolic sine of a number, that can be expressed
|
/// The Math.sinh() function returns the hyperbolic sine of a number, that can be expressed
|
||||||
/// using the constant e: Math.sinh(x) = (e^x - e^-x)/2
|
/// using the constant e: Math.sinh(x) = (e^x - e^-x)/2
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sinh)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sinh)
|
||||||
#[wasm_bindgen(static_method_of = Math)]
|
#[wasm_bindgen(js_namespace = Math)]
|
||||||
pub fn sinh(x: f64) -> f64;
|
pub fn sinh(x: f64) -> f64;
|
||||||
|
|
||||||
/// The Math.sqrt() function returns the square root of a number, that is
|
/// The Math.sqrt() function returns the square root of a number, that is
|
||||||
/// ∀x ≥ 0, Math.sqrt(x) = √x = the unique y ≥ 0 such that y^2 = x
|
/// ∀x ≥ 0, Math.sqrt(x) = √x = the unique y ≥ 0 such that y^2 = x
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sqrt)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sqrt)
|
||||||
#[wasm_bindgen(static_method_of = Math)]
|
#[wasm_bindgen(js_namespace = Math)]
|
||||||
pub fn sqrt(x: f64) -> f64;
|
pub fn sqrt(x: f64) -> f64;
|
||||||
|
|
||||||
/// The Math.tan() function returns the tangent of a number.
|
/// The Math.tan() function returns the tangent of a number.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/tan)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/tan)
|
||||||
#[wasm_bindgen(static_method_of = Math)]
|
#[wasm_bindgen(js_namespace = Math)]
|
||||||
pub fn tan(x: f64) -> f64;
|
pub fn tan(x: f64) -> f64;
|
||||||
|
|
||||||
/// The Math.tanh() function returns the hyperbolic tangent of a number, that is
|
/// The Math.tanh() function returns the hyperbolic tangent of a number, that is
|
||||||
/// tanh x = sinh x / cosh x = (e^x - e^-x)/(e^x + e^-x) = (e^2x - 1)/(e^2x + 1)
|
/// tanh x = sinh x / cosh x = (e^x - e^-x)/(e^x + e^-x) = (e^2x - 1)/(e^2x + 1)
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/tanh)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/tanh)
|
||||||
#[wasm_bindgen(static_method_of = Math)]
|
#[wasm_bindgen(js_namespace = Math)]
|
||||||
pub fn tanh(x: f64) -> f64;
|
pub fn tanh(x: f64) -> f64;
|
||||||
|
|
||||||
/// The Math.trunc() function returns the integer part of a number by removing any fractional
|
/// The Math.trunc() function returns the integer part of a number by removing any fractional
|
||||||
/// digits.
|
/// digits.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/trunc)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/trunc)
|
||||||
#[wasm_bindgen(static_method_of = Math)]
|
#[wasm_bindgen(js_namespace = Math)]
|
||||||
pub fn trunc(x: f64) -> f64;
|
pub fn trunc(x: f64) -> f64;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Number.
|
// Number.
|
||||||
@ -2232,18 +2233,18 @@ extern "C" {
|
|||||||
pub fn new(message: &str) -> ReferenceError;
|
pub fn new(message: &str) -> ReferenceError;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reflect
|
#[allow(non_snake_case)]
|
||||||
#[wasm_bindgen]
|
pub mod Reflect {
|
||||||
extern "C" {
|
use super::*;
|
||||||
#[wasm_bindgen(extends = Object)]
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
||||||
pub type Reflect;
|
|
||||||
|
|
||||||
|
// Reflect
|
||||||
|
#[wasm_bindgen]
|
||||||
|
extern "C" {
|
||||||
/// The static `Reflect.apply()` method calls a target function with
|
/// The static `Reflect.apply()` method calls a target function with
|
||||||
/// arguments as specified.
|
/// arguments as specified.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/apply)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/apply)
|
||||||
#[wasm_bindgen(static_method_of = Reflect, catch)]
|
#[wasm_bindgen(js_namespace = Reflect, catch)]
|
||||||
pub fn apply(
|
pub fn apply(
|
||||||
target: &Function,
|
target: &Function,
|
||||||
this_argument: &JsValue,
|
this_argument: &JsValue,
|
||||||
@ -2255,7 +2256,7 @@ extern "C" {
|
|||||||
/// gives also the added option to specify a different prototype.
|
/// gives also the added option to specify a different prototype.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/construct)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/construct)
|
||||||
#[wasm_bindgen(static_method_of = Reflect, catch)]
|
#[wasm_bindgen(js_namespace = Reflect, catch)]
|
||||||
pub fn construct(target: &Function, arguments_list: &Array) -> Result<JsValue, JsValue>;
|
pub fn construct(target: &Function, arguments_list: &Array) -> Result<JsValue, JsValue>;
|
||||||
|
|
||||||
/// The static `Reflect.construct()` method acts like the new operator, but
|
/// The static `Reflect.construct()` method acts like the new operator, but
|
||||||
@ -2263,7 +2264,7 @@ extern "C" {
|
|||||||
/// gives also the added option to specify a different prototype.
|
/// gives also the added option to specify a different prototype.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/construct)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/construct)
|
||||||
#[wasm_bindgen(static_method_of = Reflect, js_name = construct, catch)]
|
#[wasm_bindgen(js_namespace = Reflect, js_name = construct, catch)]
|
||||||
pub fn construct_with_new_target(
|
pub fn construct_with_new_target(
|
||||||
target: &Function,
|
target: &Function,
|
||||||
arguments_list: &Array,
|
arguments_list: &Array,
|
||||||
@ -2274,7 +2275,7 @@ extern "C" {
|
|||||||
/// `Object.defineProperty()` but returns a `Boolean`.
|
/// `Object.defineProperty()` but returns a `Boolean`.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/defineProperty)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/defineProperty)
|
||||||
#[wasm_bindgen(static_method_of = Reflect, js_name = defineProperty, catch)]
|
#[wasm_bindgen(js_namespace = Reflect, js_name = defineProperty, catch)]
|
||||||
pub fn define_property(
|
pub fn define_property(
|
||||||
target: &Object,
|
target: &Object,
|
||||||
property_key: &JsValue,
|
property_key: &JsValue,
|
||||||
@ -2285,22 +2286,22 @@ extern "C" {
|
|||||||
/// properties. It is like the `delete` operator as a function.
|
/// properties. It is like the `delete` operator as a function.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/deleteProperty)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/deleteProperty)
|
||||||
#[wasm_bindgen(static_method_of = Reflect, js_name = deleteProperty, catch)]
|
#[wasm_bindgen(js_namespace = Reflect, js_name = deleteProperty, catch)]
|
||||||
pub fn delete_property(target: &Object, key: &JsValue) -> Result<bool, JsValue>;
|
pub fn delete_property(target: &Object, key: &JsValue) -> Result<bool, JsValue>;
|
||||||
|
|
||||||
/// The static `Reflect.get()` method works like getting a property from
|
/// The static `Reflect.get()` method works like getting a property from
|
||||||
/// an object (`target[propertyKey]`) as a function.
|
/// an object (`target[propertyKey]`) as a function.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/get)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/get)
|
||||||
#[wasm_bindgen(static_method_of = Reflect, catch)]
|
#[wasm_bindgen(js_namespace = Reflect, catch)]
|
||||||
pub fn get(target: &JsValue, key: &JsValue) -> Result<JsValue, JsValue>;
|
pub fn get(target: &JsValue, key: &JsValue) -> Result<JsValue, JsValue>;
|
||||||
|
|
||||||
/// The same as [`Reflect::get`](#method.get) except the key is an `f64`, which is slightly faster.
|
/// The same as [`Reflect::get`](#method.get) except the key is an `f64`, which is slightly faster.
|
||||||
#[wasm_bindgen(static_method_of = Reflect, js_name = "get", catch)]
|
#[wasm_bindgen(js_namespace = Reflect, js_name = "get", catch)]
|
||||||
pub fn get_f64(target: &JsValue, key: f64) -> Result<JsValue, JsValue>;
|
pub fn get_f64(target: &JsValue, key: f64) -> Result<JsValue, JsValue>;
|
||||||
|
|
||||||
/// The same as [`Reflect::get`](#method.get) except the key is a `u32`, which is slightly faster.
|
/// The same as [`Reflect::get`](#method.get) except the key is a `u32`, which is slightly faster.
|
||||||
#[wasm_bindgen(static_method_of = Reflect, js_name = "get", catch)]
|
#[wasm_bindgen(js_namespace = Reflect, js_name = "get", catch)]
|
||||||
pub fn get_u32(target: &JsValue, key: u32) -> Result<JsValue, JsValue>;
|
pub fn get_u32(target: &JsValue, key: u32) -> Result<JsValue, JsValue>;
|
||||||
|
|
||||||
/// The static `Reflect.getOwnPropertyDescriptor()` method is similar to
|
/// The static `Reflect.getOwnPropertyDescriptor()` method is similar to
|
||||||
@ -2308,7 +2309,7 @@ extern "C" {
|
|||||||
/// of the given property if it exists on the object, `undefined` otherwise.
|
/// of the given property if it exists on the object, `undefined` otherwise.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/getOwnPropertyDescriptor)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/getOwnPropertyDescriptor)
|
||||||
#[wasm_bindgen(static_method_of = Reflect, js_name = getOwnPropertyDescriptor, catch)]
|
#[wasm_bindgen(js_namespace = Reflect, js_name = getOwnPropertyDescriptor, catch)]
|
||||||
pub fn get_own_property_descriptor(
|
pub fn get_own_property_descriptor(
|
||||||
target: &Object,
|
target: &Object,
|
||||||
property_key: &JsValue,
|
property_key: &JsValue,
|
||||||
@ -2320,14 +2321,14 @@ extern "C" {
|
|||||||
/// the specified object.
|
/// the specified object.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/getPrototypeOf)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/getPrototypeOf)
|
||||||
#[wasm_bindgen(static_method_of = Reflect, js_name = getPrototypeOf, catch)]
|
#[wasm_bindgen(js_namespace = Reflect, js_name = getPrototypeOf, catch)]
|
||||||
pub fn get_prototype_of(target: &JsValue) -> Result<Object, JsValue>;
|
pub fn get_prototype_of(target: &JsValue) -> Result<Object, JsValue>;
|
||||||
|
|
||||||
/// The static `Reflect.has()` method works like the in operator as a
|
/// The static `Reflect.has()` method works like the in operator as a
|
||||||
/// function.
|
/// function.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/has)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/has)
|
||||||
#[wasm_bindgen(static_method_of = Reflect, catch)]
|
#[wasm_bindgen(js_namespace = Reflect, catch)]
|
||||||
pub fn has(target: &JsValue, property_key: &JsValue) -> Result<bool, JsValue>;
|
pub fn has(target: &JsValue, property_key: &JsValue) -> Result<bool, JsValue>;
|
||||||
|
|
||||||
/// The static `Reflect.isExtensible()` method determines if an object is
|
/// The static `Reflect.isExtensible()` method determines if an object is
|
||||||
@ -2335,14 +2336,14 @@ extern "C" {
|
|||||||
/// similar to `Object.isExtensible()`, but with some differences.
|
/// similar to `Object.isExtensible()`, but with some differences.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/isExtensible)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/isExtensible)
|
||||||
#[wasm_bindgen(static_method_of = Reflect, js_name = isExtensible, catch)]
|
#[wasm_bindgen(js_namespace = Reflect, js_name = isExtensible, catch)]
|
||||||
pub fn is_extensible(target: &Object) -> Result<bool, JsValue>;
|
pub fn is_extensible(target: &Object) -> Result<bool, JsValue>;
|
||||||
|
|
||||||
/// The static `Reflect.ownKeys()` method returns an array of the
|
/// The static `Reflect.ownKeys()` method returns an array of the
|
||||||
/// target object's own property keys.
|
/// target object's own property keys.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/ownKeys)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/ownKeys)
|
||||||
#[wasm_bindgen(static_method_of = Reflect, js_name = ownKeys, catch)]
|
#[wasm_bindgen(js_namespace = Reflect, js_name = ownKeys, catch)]
|
||||||
pub fn own_keys(target: &JsValue) -> Result<Array, JsValue>;
|
pub fn own_keys(target: &JsValue) -> Result<Array, JsValue>;
|
||||||
|
|
||||||
/// The static `Reflect.preventExtensions()` method prevents new
|
/// The static `Reflect.preventExtensions()` method prevents new
|
||||||
@ -2351,29 +2352,29 @@ extern "C" {
|
|||||||
/// `Object.preventExtensions()`, but with some differences.
|
/// `Object.preventExtensions()`, but with some differences.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/preventExtensions)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/preventExtensions)
|
||||||
#[wasm_bindgen(static_method_of = Reflect, js_name = preventExtensions, catch)]
|
#[wasm_bindgen(js_namespace = Reflect, js_name = preventExtensions, catch)]
|
||||||
pub fn prevent_extensions(target: &Object) -> Result<bool, JsValue>;
|
pub fn prevent_extensions(target: &Object) -> Result<bool, JsValue>;
|
||||||
|
|
||||||
/// The static `Reflect.set()` method works like setting a
|
/// The static `Reflect.set()` method works like setting a
|
||||||
/// property on an object.
|
/// property on an object.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/set)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/set)
|
||||||
#[wasm_bindgen(static_method_of = Reflect, catch)]
|
#[wasm_bindgen(js_namespace = Reflect, catch)]
|
||||||
pub fn set(target: &JsValue, property_key: &JsValue, value: &JsValue) -> Result<bool, JsValue>;
|
pub fn set(target: &JsValue, property_key: &JsValue, value: &JsValue) -> Result<bool, JsValue>;
|
||||||
|
|
||||||
/// The same as [`Reflect::set`](#method.set) except the key is an `f64`, which is slightly faster.
|
/// The same as [`Reflect::set`](#method.set) except the key is an `f64`, which is slightly faster.
|
||||||
#[wasm_bindgen(static_method_of = Reflect, js_name = "set", catch)]
|
#[wasm_bindgen(js_namespace = Reflect, js_name = "set", catch)]
|
||||||
pub fn set_f64(target: &JsValue, property_key: f64, value: &JsValue) -> Result<bool, JsValue>;
|
pub fn set_f64(target: &JsValue, property_key: f64, value: &JsValue) -> Result<bool, JsValue>;
|
||||||
|
|
||||||
/// The same as [`Reflect::set`](#method.set) except the key is a `u32`, which is slightly faster.
|
/// The same as [`Reflect::set`](#method.set) except the key is a `u32`, which is slightly faster.
|
||||||
#[wasm_bindgen(static_method_of = Reflect, js_name = "set", catch)]
|
#[wasm_bindgen(js_namespace = Reflect, js_name = "set", catch)]
|
||||||
pub fn set_u32(target: &JsValue, property_key: u32, value: &JsValue) -> Result<bool, JsValue>;
|
pub fn set_u32(target: &JsValue, property_key: u32, value: &JsValue) -> Result<bool, JsValue>;
|
||||||
|
|
||||||
/// The static `Reflect.set()` method works like setting a
|
/// The static `Reflect.set()` method works like setting a
|
||||||
/// property on an object.
|
/// property on an object.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/set)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/set)
|
||||||
#[wasm_bindgen(static_method_of = Reflect, js_name = set, catch)]
|
#[wasm_bindgen(js_namespace = Reflect, js_name = set, catch)]
|
||||||
pub fn set_with_receiver(
|
pub fn set_with_receiver(
|
||||||
target: &JsValue,
|
target: &JsValue,
|
||||||
property_key: &JsValue,
|
property_key: &JsValue,
|
||||||
@ -2387,8 +2388,9 @@ extern "C" {
|
|||||||
/// object to another object or to null.
|
/// object to another object or to null.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/setPrototypeOf)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/setPrototypeOf)
|
||||||
#[wasm_bindgen(static_method_of = Reflect, js_name = setPrototypeOf, catch)]
|
#[wasm_bindgen(js_namespace = Reflect, js_name = setPrototypeOf, catch)]
|
||||||
pub fn set_prototype_of(target: &Object, prototype: &JsValue) -> Result<bool, JsValue>;
|
pub fn set_prototype_of(target: &Object, prototype: &JsValue) -> Result<bool, JsValue>;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// RegExp
|
// RegExp
|
||||||
@ -3064,28 +3066,28 @@ pub mod WebAssembly {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// JSON
|
/// The `JSON` object contains methods for parsing [JavaScript Object
|
||||||
#[wasm_bindgen]
|
/// Notation (JSON)](https://json.org/) and converting values to JSON. It
|
||||||
extern "C" {
|
/// can't be called or constructed, and aside from its two method
|
||||||
/// The `JSON` object contains methods for parsing [JavaScript Object
|
/// properties, it has no interesting functionality of its own.
|
||||||
/// Notation (JSON)](https://json.org/) and converting values to JSON. It
|
#[allow(non_snake_case)]
|
||||||
/// can't be called or constructed, and aside from its two method
|
pub mod JSON {
|
||||||
/// properties, it has no interesting functionality of its own.
|
use super::*;
|
||||||
#[wasm_bindgen(extends = Object)]
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
||||||
pub type JSON;
|
|
||||||
|
|
||||||
|
// JSON
|
||||||
|
#[wasm_bindgen]
|
||||||
|
extern "C" {
|
||||||
/// The `JSON.parse()` method parses a JSON string, constructing the
|
/// The `JSON.parse()` method parses a JSON string, constructing the
|
||||||
/// JavaScript value or object described by the string.
|
/// JavaScript value or object described by the string.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse)
|
||||||
#[wasm_bindgen(catch, static_method_of = JSON)]
|
#[wasm_bindgen(catch, js_namespace = JSON)]
|
||||||
pub fn parse(text: &str) -> Result<JsValue, JsValue>;
|
pub fn parse(text: &str) -> Result<JsValue, JsValue>;
|
||||||
|
|
||||||
/// The `JSON.stringify()` method converts a JavaScript value to a JSON string.
|
/// The `JSON.stringify()` method converts a JavaScript value to a JSON string.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify)
|
||||||
#[wasm_bindgen(catch, static_method_of = JSON)]
|
#[wasm_bindgen(catch, js_namespace = JSON)]
|
||||||
pub fn stringify(obj: &JsValue) -> Result<JsString, JsValue>;
|
pub fn stringify(obj: &JsValue) -> Result<JsString, JsValue>;
|
||||||
|
|
||||||
/// The `JSON.stringify()` method converts a JavaScript value to a JSON string.
|
/// The `JSON.stringify()` method converts a JavaScript value to a JSON string.
|
||||||
@ -3097,7 +3099,7 @@ extern "C" {
|
|||||||
/// of the object are included in the resulting JSON string.
|
/// of the object are included in the resulting JSON string.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify)
|
||||||
#[wasm_bindgen(catch, static_method_of = JSON, js_name = stringify)]
|
#[wasm_bindgen(catch, js_namespace = JSON, js_name = stringify)]
|
||||||
pub fn stringify_with_replacer(obj: &JsValue, replacer: &JsValue) -> Result<JsString, JsValue>;
|
pub fn stringify_with_replacer(obj: &JsValue, replacer: &JsValue) -> Result<JsString, JsValue>;
|
||||||
|
|
||||||
/// The `JSON.stringify()` method converts a JavaScript value to a JSON string.
|
/// The `JSON.stringify()` method converts a JavaScript value to a JSON string.
|
||||||
@ -3118,13 +3120,14 @@ extern "C" {
|
|||||||
/// white space is used.
|
/// white space is used.
|
||||||
///
|
///
|
||||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify)
|
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify)
|
||||||
#[wasm_bindgen(catch, static_method_of = JSON, js_name = stringify)]
|
#[wasm_bindgen(catch, js_namespace = JSON, js_name = stringify)]
|
||||||
pub fn stringify_with_replacer_and_space(
|
pub fn stringify_with_replacer_and_space(
|
||||||
obj: &JsValue,
|
obj: &JsValue,
|
||||||
replacer: &JsValue,
|
replacer: &JsValue,
|
||||||
space: &JsValue,
|
space: &JsValue,
|
||||||
) -> Result<JsString, JsValue>;
|
) -> Result<JsString, JsValue>;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// JsString
|
// JsString
|
||||||
|
@ -198,15 +198,3 @@ fn stringify_with_replacer_and_space_error() {
|
|||||||
let err_msg: String = From::from(err.message());
|
let err_msg: String = From::from(err.message());
|
||||||
assert!(err_msg.contains("rust really rocks"));
|
assert!(err_msg.contains("rust really rocks"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[wasm_bindgen_test]
|
|
||||||
fn json_extends() {
|
|
||||||
#[wasm_bindgen]
|
|
||||||
extern "C" {
|
|
||||||
#[wasm_bindgen(js_name = JSON)]
|
|
||||||
static json: JSON;
|
|
||||||
}
|
|
||||||
|
|
||||||
assert!(json.is_instance_of::<Object>());
|
|
||||||
let _: &Object = json.as_ref();
|
|
||||||
}
|
|
||||||
|
@ -2,21 +2,8 @@ use std::f64::consts::PI;
|
|||||||
use std::f64::{NAN, NEG_INFINITY};
|
use std::f64::{NAN, NEG_INFINITY};
|
||||||
|
|
||||||
use js_sys::*;
|
use js_sys::*;
|
||||||
use wasm_bindgen::{prelude::*, JsCast};
|
|
||||||
use wasm_bindgen_test::*;
|
use wasm_bindgen_test::*;
|
||||||
|
|
||||||
#[wasm_bindgen_test]
|
|
||||||
fn math_extends() {
|
|
||||||
#[wasm_bindgen]
|
|
||||||
extern "C" {
|
|
||||||
#[wasm_bindgen(js_name = Math)]
|
|
||||||
static math: Math;
|
|
||||||
}
|
|
||||||
|
|
||||||
assert!(math.is_instance_of::<Object>());
|
|
||||||
let _: &Object = math.as_ref();
|
|
||||||
}
|
|
||||||
|
|
||||||
macro_rules! assert_eq {
|
macro_rules! assert_eq {
|
||||||
($a:expr, $b:expr) => {{
|
($a:expr, $b:expr) => {{
|
||||||
let (a, b) = (&$a, &$b);
|
let (a, b) = (&$a, &$b);
|
||||||
|
@ -229,18 +229,6 @@ fn set_prototype_of() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[wasm_bindgen_test]
|
|
||||||
fn reflect_extends() {
|
|
||||||
#[wasm_bindgen]
|
|
||||||
extern "C" {
|
|
||||||
#[wasm_bindgen(js_name = Reflect)]
|
|
||||||
static reflect: Reflect;
|
|
||||||
}
|
|
||||||
|
|
||||||
assert!(reflect.is_instance_of::<Object>());
|
|
||||||
let _: &Object = reflect.as_ref();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[wasm_bindgen_test]
|
#[wasm_bindgen_test]
|
||||||
fn reflect_bindings_handle_proxies_that_just_throw_for_everything() {
|
fn reflect_bindings_handle_proxies_that_just_throw_for_everything() {
|
||||||
let p = throw_all_the_time();
|
let p = throw_all_the_time();
|
||||||
|
Reference in New Issue
Block a user