Learning Dojo -- 3.3 Asynchronous Programming
1.Handling dom events
a.Define the event handler
function alertSomeEvent(){ alert("someEvent"); } function connect(){ dojo.connect(dojo.byId("someButton"),"click", alertSomeEvent); }dojo.addOnLoad(connect);
<!--I'm going to publish this topic when I am clicked --> <button onclick="javascript:dojo.publish('someTopic')">publish</button> //A topic handler will handle this topic dojo.subscribe("someTopic", handleSomeTopic); //And it will handle the topic like this, function handleSomeTopic(){ alert("some topic is published"); }}