A simple Dojo plugin to enable an easier to read format for dojo.connect.
// before
var handle = dojo.connect(dojo.byId("someNode"), "click", function(evt) {
evt.preventDefault();
dojo.style(evt.currentTarget, "color", "red");
});
dojo.disconnect(handle);
// with dojo.on()
dojo.on("someNode", "click")
.prevent()
.then(function(evt){
dojo.style(evt.currentTarget, "color", "red");
})
.disconnect();
// with dojo.eat() and some friends
// dojo.eat() is just like dojo.on().prevent()
dojo.eat("someNode", "click")
.then(function(evt) {
dojo.style(evt.currentTarget, "color", "red");
})
.disconnect();