@sygnal/fix
v0.1.1
Published
Functional Interactions (FIX): declarative trigger/action system for Sygnal sites.
Downloads
38
Readme
@sygnal/fix
Functional Interactions (FIX) - declarative trigger/action system for Sygnal sites.
Usage
import {
initializeFIX,
registerActionType,
registerTriggerType,
registerProgrammaticAction,
EventSequential,
EventRegistry
} from '@sygnal/fix';
// Register custom types (attribute-driven)
registerTriggerType('submit', TriggerSubmit);
registerActionType('api-call', ActionApiCall);
EventRegistry.registerEvent('hero-enter', new EventSequential('hero-enter'));
initializeFIX();
// Optionally register a programmatic action bound to a fixed event (no DOM element)
registerProgrammaticAction('log', 'hero-enter', ActionLog);Add attributes in HTML:
<button trigger:click="hero-enter" trigger:click:data:section="hero"></button>
<div action:click="hero-enter"></div>When to use which registration helper
registerTriggerType(name, TriggerCtor): make a trigger available fortrigger:name="event"attributes; instances are created duringinitializeFIX()as the DOM is scanned.registerActionType(name, ActionCtor): make an action available foraction:name="event"attributes; instances are created duringinitializeFIX()and wired to the event declared in the attribute value.registerProgrammaticAction(name, event, ActionCtor): create and register an action instance immediately and attach it to a specific event (no element required) for code-driven or global behaviors.
Build
npm install
npm run build