web: forms, content, pages, zero-install
desktop: responsive and synchronized UI, stable, local storage
mobile: always with you, "live"
DOM Events are "a platform- and language-neutral interface that gives to programs and scripts a generic event system.
A good event system: "Like crack for web developers"
<p id="foo">foo</p>
function handler(evt) {alert(evt.innerHTML);}
foo
document.getElementById("foo").addEventListener( "click", handler, false);dojo.event.connect( dojo.byId("foo"), "onclick", handler);connect( $("foo"), "onclick", handler);Event.observe( $("foo"), "click", handler, false);YAHOO.util.Event.addListener( "foo", "click", handler);
function foo() {
dojo.debug("foo");
}
function bar() {
dojo.debug("bar");
}
dojo.event.connect(dj_global, "foo", dj_global, "bar");connect(dj_global, "foo", dj_global, "bar");
var listeningObject = function() {
this.onUpdateDate = function(evt) {
}
}
var filterObject = {
"foo": "fooValue",
"bar": "barValue"
// params to pass or mutate
}
dojo.event.topic.publish("updateDate/startDate", "filterObject");
dojo.event.topic.subscribe("updateDate/startDate", listeningObject, "onUpdateDate");
function PublishObject(name) {
this.name = name;
this.testEvent = new YAHOO.util.CustomEvent("testEvent", this);
}
function SubscribeObject(name, pubObj) {
this.name = name;
this.pubObj = pubObj;
this.pubObj.testEvent.subscribe(this.onTestEvent, this);
}
SubscribeObject.prototype.onTestEvent = function(type, args, me) {
/* do something; */
}
var pub = new PublishObject("testPub");
var sub = new SubscribeObject("testSub");
pub.testEvent.fire(filterObject);
AOP style advice to interject and interrupt the call order and arguments. Of toolkits reviewed, only found in Dojo.
dojo.event.connect("before", this, "onFoo", this, "onBar");repubsub.RepubsubIO.subscribe("/socialevents/" + this.eventId + "/responseStatusTotals", this, "setTallies", null, 1, null);

HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
<div dojoType="showslide" title="Brought to You by the Dojo Show Widget">
<ul>
<li>This presentation uses the Dojo Show widget, inspired by Eric Meyer's S5 widget</li>
</ul>
</div>