Evently is a jQuery plugin for writing event-based applications.
Evently is a jQuery plugin for writing event-based applications. Bsically it uses an object notation to group events related to a same DOM node, making the code cleaner and more maintainable. Evently was thought as a tool to make CouchDB application development simpler, but you can use it for any project where you could use jQuery.
Let's take a look to a simple example from the Evently primer.
In jQuery you have to repeat yourself when you attach different event listener to a DOM node:
$("#myelement").bind("click", function() {
$(this).text("You clicked me.");
});
$("#myelement").bind("mouseenter", function() {
$(this).text("You moused over me.");
});
$("#myelement").bind("loggedIn", function(e, user) {
$(this).text("You are logged in.");
});
Evently use a single object instead:
$("#myelement").evently({
click : function() {
$(this).text("You clicked me.");
},
mouseenter : function() {
$(this).text("You moused over me.");
},
loggedIn : function() {
$(this).text("You are logged in.");
}
});
Evently has more interesting features. From the primer:
1) Evently has a built-in way to handle Ajax calls and Mustache templating.
2) Evently widgets can contain other Evently widgets, nested like matryoshka dolls. This turns out to be hella useful.
3) Evently has some magic events, including a handler for realtime updates from CouchDB.
4) Evently code can be represented as a deeply-nested filesystem tree, when you use the CouchApp script to deploy it.
For more information on this plugin,