Move the js module to a js_sys crate (#512)

* Move the `js` module to a `js_sys` crate

* Update js-sys tests to pass again

* Update binding_to_unimplemented_apis_doesnt_break_everything

Remove its dependency on the `js` module

* Update metadata for js-sys

* Fix the `closures` example
This commit is contained in:
Alex Crichton
2018-07-19 14:30:58 -05:00
committed by GitHub
parent 3e2d1e6519
commit 6eef5f7b52
36 changed files with 683 additions and 605 deletions

View File

@ -423,7 +423,6 @@ fn binding_to_unimplemented_apis_doesnt_break_everything() {
#![feature(use_extern_macros, wasm_import_module)]
extern crate wasm_bindgen;
use wasm_bindgen::prelude::*;
use wasm_bindgen::js::*;
#[wasm_bindgen]
extern {
@ -433,27 +432,16 @@ fn binding_to_unimplemented_apis_doesnt_break_everything() {
#[wasm_bindgen(constructor)]
fn new() -> Array;
#[wasm_bindgen(method)]
fn standardized_method_this_js_runtime_doesnt_implement_yet(this: &Array);
#[wasm_bindgen(method, catch)]
fn standardized_method_this_js_runtime_doesnt_implement_yet(this: &Array)
-> Result<(), JsValue>;
}
#[wasm_bindgen]
pub fn test() {
let array = Array::new();
let array_obj: JsValue = array.clone().into();
let array_obj = array_obj.as_object().unwrap();
let array_proto = Reflect::get_prototype_of(&array_obj);
let unimplemented = Reflect::get(
&array_proto,
&JsValue::from_str("standardized_method_this_js_runtime_doesnt_implement_yet")
);
if unimplemented.is_function() {
array.standardized_method_this_js_runtime_doesnt_implement_yet();
}
let res = array.standardized_method_this_js_runtime_doesnt_implement_yet();
assert!(res.is_err());
}
"#,
)