Argument | Type | Description |
---|---|---|
target | Object | This is the target object (a DOM node or other event emitting object) that will be the source of the event. The target object may be a host object with its own event capabilities (like DOM elements or the window),or it may be a JavaScript object with anon()method. |
type | String | This is the name of the event type to be dispatched (likeselect). This event may be a standard event (likeclick) or a custom event (likefinished). |
event | Object | This is an object with the properties of the event to be dispatched. Generally you should align your properties with W3C standards. Two properties are of particular importance:
|
Name | Type | Description |
---|---|---|
target | Element|Object | This is the target object or DOM element that to receive events from |
type | String|Function | This is the name of the event to listen for or an extension event type. |
listener | Function | This is the function that should be called when the event fires. |
dontFix | undefined |
this.emit("createJob",{});
}
alert(0);
});
<button id="alertButton">Alert the user</button>
<button id="createAlert">Create another alert button</button>
----------------------------------------------------------------------------
<script>
require(["dojo/on","dojo/topic","dojo/dom-construct","dojo/dom","dojo/domReady!"],
function(on,topic,domConstruct,dom) {
var alertButton = dom.byId("alertButton"),
createAlert = dom.byId("createAlert");
on(alertButton,"click",function() {
// When this button is clicked,
// publish to the "alertUser" topic
topic.publish("alertUser","I am alerting you.");
});
on(createAlert,function(evt){
// Create another button
var anotherButton = domConstruct.create("button",{
innerHTML: "Another alert button"
},createAlert,"after");
// When the other button is clicked,
// publish to the "alertUser" topic
on(anotherButton,function(evt){
topic.publish("alertUser","I am also alerting you.");
});
});
// Register the alerting routine with the "alertUser" topic.
topic.subscribe("alertUser",function(text){
alert(text);
});
});
</script>