hooks

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2026 License: MIT Imports: 3 Imported by: 0

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

func Hook(name string, config any) vdom.Attr

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

func OnEvent(name string, handler func(HookEvent)) vdom.Attr

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.

Types

type HookEvent

type HookEvent = corevango.HookEvent

HookEvent represents an event triggered by a client hook. It is the canonical type used by the public API: `func(vango.HookEvent)`.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL