a reactive (signals based) hypermedia web framework (wip) stormlightlabs.github.io/volt
hypermedia frontend signals
voltx docs api plugin.md
1.4 kB
Markdown
at commit d896f7fe


version: 1.0 updated: 2025-10-18 #

plugin #

Plugin system for extending VoltX.js with custom bindings

registerPlugin #

Register a custom plugin with a given name. Plugins extend VoltX.js with custom data-volt-* attribute bindings.

export function registerPlugin(name: string, handler: PluginHandler): void

Example:

registerPlugin('tooltip', (context, value) => {
  const tooltip = document.createElement('div');
  tooltip.className = 'tooltip';
  tooltip.textContent = value;
  context.element.addEventListener('mouseenter', () => {
    document.body.appendChild(tooltip);
  });
  context.element.addEventListener('mouseleave', () => {
    tooltip.remove();
  });
  context.addCleanup(() => tooltip.remove());
});

getPlugin #

Get a plugin handler by name.

export function getPlugin(name: string): PluginHandler | undefined

hasPlugin #

Check if a plugin is registered.

export function hasPlugin(name: string): boolean

unregisterPlugin #

Unregister a plugin by name.

export function unregisterPlugin(name: string): boolean

getRegisteredPlugins #

Get all registered plugin names.

export function getRegisteredPlugins(): string[]

clearPlugins #

Clear all registered plugins.

export function clearPlugins(): void