volt.d
Context object available to all bindings
CleanupFunction
() => voidScope
Record<string, unknown>BindingContext
Context object available to all bindings
{ element: Element; scope: Scope; cleanups: CleanupFunction[] }PluginContext
Context object provided to plugin handlers. Contains utilities and references for implementing custom bindings.
Members
- element:
ElementThe DOM element the plugin is bound to - scope:
ScopeThe scope object containing signals and data - lifecycle:
PluginLifecycleLifecycle hooks for plugin-specific mount/unmount behavior
PluginHandler
Plugin handler function signature. Receives context and the attribute value, performs binding setup.
(context: PluginContext, value: string) => voidSignal
A reactive primitive that notifies subscribers when its value changes.
ComputedSignal
A computed signal that derives its value from other signals.
StorageAdapter
Storage adapter interface for custom persistence backends
ChargedRoot
Information about a mounted Volt root after charging
element: The root element that was mounted scope: The reactive scope created for this root cleanup: Cleanup function to unmount this root
{ element: Element; scope: Scope; cleanup: CleanupFunction }ChargeResult
Result of charging Volt roots
roots: Array of all charged roots cleanup: Cleanup function to unmount all roots
{ roots: ChargedRoot[]; cleanup: CleanupFunction }Dep
{ get: () => unknown; subscribe: (callback: (value: unknown) => void) => () => void }AsyncEffectOptions
Options for configuring async effects
Members
- abortable:
booleanEnable automatic AbortController integration. When true, provides an AbortSignal to the effect function for canceling async operations. - debounce:
numberDebounce delay in milliseconds. Effect execution is delayed until this duration has passed without dependencies changing. - throttle:
numberThrottle delay in milliseconds. Effect execution is rate-limited to at most once per this duration. - onError:
(error: Error, retry: () => void) => voidError handler for async effect failures. Receives the error and a retry function. - retries:
numberNumber of automatic retry attempts on error. Defaults to 0 (no retries). - retryDelay:
numberDelay in milliseconds between retry attempts. Defaults to 0 (immediate retry).
AsyncEffectFunction
Async effect function signature. Receives an optional AbortSignal when abortable option is enabled. Can return a cleanup function or a Promise that resolves to a cleanup function.
(signal?: AbortSignal) => Promise<void | (() => void)>LifecycleHookCallback
Lifecycle hook callback types
() => voidMountHookCallback
(root: Element, scope: Scope) => voidUnmountHookCallback
(root: Element) => voidElementMountHookCallback
(element: Element, scope: Scope) => voidElementUnmountHookCallback
(element: Element) => voidBindingHookCallback
(element: Element, bindingName: string) => voidGlobalHookName
Lifecycle hook names
"beforeMount" | "afterMount" | "beforeUnmount" | "afterUnmount"PluginLifecycle
Extended plugin context with lifecycle hooks
Members
- onMount:
(callback: LifecycleHookCallback) => voidRegister a callback to run when the plugin is initialized for an element - onUnmount:
(callback: LifecycleHookCallback) => voidRegister a callback to run when the element is being unmounted - beforeBinding:
(callback: LifecycleHookCallback) => voidRegister a callback to run before the binding is created - afterBinding:
(callback: LifecycleHookCallback) => voidRegister a callback to run after the binding is created