Documentation
¶
Overview ¶
Package hooks provides client-side interaction hooks for Vango components.
Deprecated: The v1 Developer Guide exposes hooks via `vango.Hook` and `vango.OnEvent` (or the `el` DSL). This package is retained for legacy/internal use only.
Hooks enable high-performance client-side physics and interactions (like drag-and-drop) while keeping state management on the server.
Usage (v1 canonical):
Div(
vango.Hook("Sortable", map[string]any{"group": "tasks"}),
vango.OnEvent("reorder", func(e vango.HookEvent) { ... }),
)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Hook ¶
Hook creates a hook attribute for an element. The config is passed to the client-side hook on mount. Config can be a struct, map, or any JSON-serializable value.
func OnEvent ¶
OnEvent creates an event handler attribute for a hook event. The handler is wrapped to filter by the specific event name, allowing multiple hook event handlers on the same element.
func OnEventValidated ¶ added in v0.2.0
func OnEventValidated(name string, validate corevango.HookEventValidator, handler func(HookEvent)) vdom.Attr
OnEventValidated attaches a hook event handler plus exact-sink validation metadata for the named hook event.