Skip to main content

Module js

Module js 

Source
Expand description

Optional, component-local JavaScript modules and explicit Rust inputs.

Derive JsInputs and mark Signal<T> fields with #[js]. JavaScript gets read-only get() and subscribe(callback) methods. Subscribe delivers the current value immediately, then one snapshot after each Rust reactive batch. Supported values are bool, String, f64, i32, u32, JsValue, Option and Vec. Use native CustomEvent payloads and event_detail to send values to Rust.

Traits§

JsInputValue
Bounded, checked JavaScript value conversion. This trait is sealed so an exposed input cannot silently acquire arbitrary serialization semantics.
JsInputs
Fields explicitly exposed to the component’s JavaScript module. Usually implemented with #[derive(fusor::JsInputs)] and #[js] field markers.

Functions§

event_detail
Read a native CustomEvent payload, checking its entire supported value shape. Null is accepted only by Option; integers reject fractional/out-of-range data.