Changed keys' type JsValue -> Object, changed description of WeakMap constructor

This commit is contained in:
Dimitrii Nemkov 2018-06-26 23:50:31 +05:00
parent a6d62c696f
commit a6c7b4b69f
2 changed files with 10 additions and 9 deletions

View File

@ -565,7 +565,8 @@ extern {
extern {
pub type WeakMap;
/// Returns the function that created an WeakMap wrapper.
/// The WeakMap object is a collection of key/value pairs in which the keys are weakly referenced.
/// The keys must be objects and the values can be arbitrary values.
///
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap
#[wasm_bindgen(constructor)]
@ -576,27 +577,27 @@ extern {
///
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap/set
#[wasm_bindgen(method, js_class="WeakMap")]
pub fn set(this: &WeakMap, key: JsValue, value: JsValue) -> WeakMap;
pub fn set(this: &WeakMap, key: Object, value: JsValue) -> WeakMap;
/// The get() method returns a specified by key element
/// from a WeakMap object.
///
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap/get
#[wasm_bindgen(method)]
pub fn get(this: &WeakMap, key: JsValue) -> JsValue;
pub fn get(this: &WeakMap, key: Object) -> JsValue;
/// The has() method returns a boolean indicating whether an element with
/// the specified key exists in the WeakMap object or not.
///
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap/has
#[wasm_bindgen(method)]
pub fn has(this: &WeakMap, key: JsValue) -> bool;
pub fn has(this: &WeakMap, key: Object) -> bool;
/// The delete() method removes the specified element from a WeakMap object.
///
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap/delete
#[wasm_bindgen(method)]
pub fn delete(this: &WeakMap, key: JsValue) -> bool;
pub fn delete(this: &WeakMap, key: Object) -> bool;
}
// JsString

View File

@ -40,7 +40,7 @@ fn get() {
use wasm_bindgen::js;
#[wasm_bindgen]
pub fn get_value(this: &js::WeakMap, key: JsValue) -> JsValue {
pub fn get_value(this: &js::WeakMap, key: js::Object) -> JsValue {
this.get(key)
}
"#)
@ -72,7 +72,7 @@ fn set() {
use wasm_bindgen::js;
#[wasm_bindgen]
pub fn set_value(this: &js::WeakMap, key: JsValue, value: JsValue) -> js::WeakMap {
pub fn set_value(this: &js::WeakMap, key: js::Object, value: js::JsValue) -> js::WeakMap {
this.set(key, value)
}
"#)
@ -101,7 +101,7 @@ fn has() {
use wasm_bindgen::js;
#[wasm_bindgen]
pub fn has_value(this: &js::WeakMap, key: JsValue) -> bool {
pub fn has_value(this: &js::WeakMap, key: js::Object) -> bool {
this.has(key)
}
"#)
@ -133,7 +133,7 @@ fn delete() {
use wasm_bindgen::js;
#[wasm_bindgen]
pub fn delete_key(this: &js::WeakMap, key: JsValue) -> bool {
pub fn delete_key(this: &js::WeakMap, key: js::Object) -> bool {
this.delete(key)
}
"#)