Skip to main content

fret_platform_web/
lib.rs

1//! Web/wasm32 platform services.
2//!
3//! This crate provides browser API integrations used by `fret-runtime::Effect`s (timers, file
4//! inputs, IME bridge, etc.). It intentionally does **not** implement input/event mapping; use a
5//! runner crate (e.g. `fret-runner-web`) for the winit/web event layer.
6//!
7//! For module ownership and “where should this go?” guidance, see
8//! `crates/fret-platform-web/README.md`.
9
10#[cfg(target_arch = "wasm32")]
11mod wasm;
12#[cfg(target_arch = "wasm32")]
13pub use wasm::*;
14
15mod ime_dom_state;
16
17#[cfg(not(target_arch = "wasm32"))]
18mod native;
19#[cfg(not(target_arch = "wasm32"))]
20pub use native::*;
21
22#[cfg(all(test, not(target_arch = "wasm32")))]
23mod tests {
24    use super::*;
25
26    #[test]
27    fn platform_error_is_actionable_on_non_wasm_targets() {
28        let err = PlatformError;
29        assert_eq!(
30            err.to_string(),
31            "fret-platform-web is only available on wasm32"
32        );
33
34        fn assert_error(_err: &dyn std::error::Error) {}
35        assert_error(&err);
36    }
37}