Declaratively add event listeners to your views.
Declaratively add event listeners to your views. It can also delegate events to a parent element. It's a plugin for Seam.
npm install event-plugin
var EventPlugin = require"event-plugin";
Init event plugin and define event handlers:
var eventPlugin =// do something with...// event is the original event// node is the dom node that was clicked;
<!-- The toggle function will be called on click, on the propagation phase -->Change route
When ready, attach the behavior to the dom via Seam:
var Seam = require"seam";var seam =event: eventPlugin;seamapplydocumentquerySelector"button";
You can also use the delegation method from event to delegate events to a parent DOM element. This improves performance are less event listeners are bound to the DOM. This is especially relevant to lists.
<!-- The ul will listen to click event and call the toggle handler if an element matching 'a' is targeted.The bubbling phase will be listened to in this case -->link1link2link3