mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-03-16 18:20:51 +00:00
js-sys: Add bindings for Symbol.unscopables
This commit is contained in:
parent
016449ab3c
commit
7af4e62d99
@ -3203,6 +3203,14 @@ extern "C" {
|
||||
#[wasm_bindgen(method, js_name = toString)]
|
||||
pub fn to_string(this: &Symbol) -> JsString;
|
||||
|
||||
/// The Symbol.unscopables well-known symbol is used to specify an object
|
||||
/// value of whose own and inherited property names are excluded from the
|
||||
/// with environment bindings of the associated object.
|
||||
///
|
||||
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/unscopables
|
||||
#[wasm_bindgen(static_method_of = Symbol, getter, structural)]
|
||||
pub fn unscopables() -> Symbol;
|
||||
|
||||
/// The valueOf() method returns the primitive value of a Symbol object.
|
||||
///
|
||||
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/valueOf
|
||||
|
@ -99,6 +99,11 @@ fn to_string() {
|
||||
assert_eq!(gensym("desc".into()).to_string(), "Symbol(desc)");
|
||||
}
|
||||
|
||||
#[wasm_bindgen_test]
|
||||
fn unscopables() {
|
||||
assert_eq!(Symbol::unscopables().to_string(), "Symbol(Symbol.unscopables)");
|
||||
}
|
||||
|
||||
#[wasm_bindgen_test]
|
||||
fn value_of() {
|
||||
let a = Symbol::for_("foo");
|
||||
|
Loading…
x
Reference in New Issue
Block a user