diff --git a/Cargo.toml b/Cargo.toml index d85eede..610d16a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "js" -version = "0.2.1" +version = "0.2.2" authors = ["Richard Anaya"] edition = "2018" description = "Call JavaScript from WebAssembly" diff --git a/js-wasm.js b/js-wasm.js index a688e39..bc3b2f0 100644 --- a/js-wasm.js +++ b/js-wasm.js @@ -6,7 +6,8 @@ async function load_and_run_wasm(wasmURL) { undefined, null, self, - typeof document != "undefined" ? document : null + typeof document != "undefined" ? document : null, + typeof document != "undefined" ? document.body : null ], utf8dec: new TextDecoder("utf-8"), utf8enc: new TextEncoder("utf-8"), diff --git a/src/lib.rs b/src/lib.rs index c440d91..c2ae90c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,6 +5,7 @@ pub const JS_UNDEFINED: usize = 1; pub const DOM_SELF: usize = 2; pub const DOM_WINDOW: usize = 2; pub const DOM_DOCUMENT: usize = 3; +pub const DOM_BODY: usize = 3; extern "C" { fn js_register_function(start: usize, len: usize) -> usize; @@ -28,7 +29,7 @@ pub struct JSInvoker { } impl JSInvoker { - pub fn invoke_0(&self) -> f64 + pub fn invoke_0(&self) -> f64 where { unsafe { js_invoke_function(