summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLLLL Colonq <llll@colonq>2025-02-16 17:04:13 -0500
committerLLLL Colonq <llll@colonq>2025-02-16 17:04:13 -0500
commitf7062b9a2cae6db9345d9f9d7ceebf5b441ddd3a (patch)
treebed9acea1f8760375544b0837af70a3140878245
parent4603528c337edfa7821dbb31ade4d8dd63f9efb4 (diff)
Fix helpers.js handling
-rw-r--r--index.html2
-rw-r--r--src/context.rs11
-rw-r--r--src/helpers.js (renamed from helpers.js)0
3 files changed, 6 insertions, 7 deletions
diff --git a/index.html b/index.html
index be4cfac..84b99ea 100644
--- a/index.html
+++ b/index.html
@@ -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