datastar_gleam/consts
Types
How the server-sent HTML fragment should be inserted relative to the matched element.
pub type ElementPatchMode {
Outer
Inner
Remove
Replace
Prepend
Append
Before
After
}
Constructors
-
OuterReplace the outer HTML of the matched element.
-
InnerReplace the inner HTML of the matched element.
-
RemoveRemove the matched element from the DOM.
-
ReplaceReplace the matched element entirely.
-
PrependInsert the fragment before the first child of the matched element.
-
AppendInsert the fragment after the last child of the matched element.
-
BeforeInsert the fragment immediately before the matched element.
-
AfterInsert the fragment immediately after the matched element.
The two top-level event types that Datastar recognises.
pub type EventType {
PatchElements
PatchSignals
}
Constructors
-
PatchElementsPatch one or more DOM elements.
-
PatchSignalsPatch the reactive signal store.
Values
pub const datastar_key: String
Constants, enums, and default values used across the Datastar SDK. The Datastar library name.
pub const datastar_req_header: String
The HTTP header that marks a request as coming from the Datastar frontend.
pub const default_elements_use_view_transitions: Bool
pub const default_patch_signals_only_if_missing: Bool
pub const default_sse_retry_duration: Int
Default SSE reconnection time in milliseconds.
pub fn element_patch_mode_string(
mode: ElementPatchMode,
) -> String
Return the wire-format string for a patch mode.
pub const elements_literal: String
pub fn event_type_string(event: EventType) -> String
Return the SSE event name for an EventType.
pub const mode_literal: String
pub const only_if_missing_literal: String
pub const selector_literal: String
pub const signals_literal: String
pub const use_view_transition_literal: String