We’ve just published the js-sys crate on crates.io!

The js-sys crate contains raw #[wasm_bindgen] bindings to all the global APIs guaranteed to exist in every JavaScript environment by the ECMAScript standard. It does not contain bindings to any Web- or Node-specific APIs. With the js-sys crate, we can work with Object s, Array s, Function s, Map s, Set s, etc… without writing the #[wasm_bindgen] imports by hand.

For example, we can invoke JavaScript Function callbacks and time how long they take to execute with Date.now() , and we don’t need to write any JS imports ourselves:

extern crate js_sys ; extern crate wasm_bindgen ; use wasm_bindgen :: prelude :: * ; #[wasm_bindgen] pub fn timed ( callback : & js_sys :: Function ) -> f64 { let then = js_sys :: Date :: now (); callback .apply ( JsValue :: null (), & js_sys :: Array :: new ()) .unwrap (); let now = js_sys :: Date :: now (); now - then }

The js-sys crate isn’t quite 100% feature complete yet. There are still some JavaScript types and methods that we don’t have bindings for. If you want to help js-sys cross the finish line, check out this issue!

Also, as mentioned above, the js-sys crate doesn’t contain bindings to any Web APIs like document.querySelectorAll . These will be part of the web-sys crate, which is mechanically generated from WebIDL interface definitions. We need help with web-sys too! If you want to help with web-sys , check out its contributing documentation and issues labeled “web-sys”.

Finally, a SUPER HUGE thank you to the 34 people who have contributed to the js-sys crate thus far! 💖