I like Meteor’s “event map” approach (http://docs.meteor.com/#eventmaps) for organizing UI event handlers, and was wondering if this or similar is available as a third-party plugin for use outside of Meteor?
Example:
Template.login.events = {
// Fires when any element is clicked
'click': function (event) { ... },
// Fires when any element with the 'accept' class is clicked
'click .accept': function (event) { ... },
// Fires when 'accept' is clicked, or a key is pressed
'keydown, click .accept': function (event) { ... }
}
Looks like jQuery supports very similar syntax:
http://api.jquery.com/on/
Seems good enough 🙂