diff options
| -rw-r--r-- | index.html | 2 | ||||
| -rw-r--r-- | src/context.rs | 11 | ||||
| -rw-r--r-- | src/helpers.js (renamed from helpers.js) | 0 |
3 files changed, 6 insertions, 7 deletions
@@ -4,8 +4,6 @@ <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> <head> <meta charset="UTF-8"> - <link data-trunk rel="copy-file" href="helpers.js" /> - <script type="module" src="helpers.js"></script> <link data-trunk rel="rust" data-wasm-opt="2" data-target-name="teleia" /> <base data-trunk-public-url /> <meta name="theme-color" media="(prefers-color-scheme: light)" content="white"> diff --git a/src/context.rs b/src/context.rs index 05d6990..502bbdb 100644 --- a/src/context.rs +++ b/src/context.rs @@ -1,10 +1,13 @@ use glow::HasContext; #[cfg(target_arch = "wasm32")] +use wasm_bindgen::prelude::*; + +#[cfg(target_arch = "wasm32")] use winit::platform::web::WindowExtWebSys; #[cfg(target_arch = "wasm32")] -#[link(wasm_import_module = "./helpers.js")] +#[wasm_bindgen(module = "/src/helpers.js")] extern { fn js_track_resized_setup(); fn js_poll_resized() -> bool; @@ -69,7 +72,7 @@ impl Context { }; #[cfg(target_arch = "wasm32")] - unsafe { js_track_resized_setup(); } + js_track_resized_setup(); let ret = Self { render_width, render_height, @@ -126,9 +129,7 @@ impl Context { #[cfg(target_arch = "wasm32")] pub fn resize_necessary(&self) -> bool { - unsafe { - js_poll_resized() - } + js_poll_resized() } #[cfg(not(target_arch = "wasm32"))] diff --git a/helpers.js b/src/helpers.js index aaaafa1..aaaafa1 100644 --- a/helpers.js +++ b/src/helpers.js |
