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:@H_403_60@
|
Name | Type | Description |
---|---|---|
target | Element|Object | This is the target object or DOM element that to receive events from@H_403_60@ |
type | String|Function | This is the name of the event to listen for or an extension event type.@H_403_60@ |
listener | Function | This is the function that should be called when the event fires.@H_403_60@ |
dontFix | undefined |
this.emit("createJob",{});
}
alert(0);
});
<button id="alertButton">Alert the user</button>
<button id="createAlert">Create another alert button</button>@H_403_60@
----------------------------------------------------------------------------@H_403_60@
<script>@H_403_60@
require(["dojo/on","dojo/topic","dojo/dom-construct","dojo/dom","dojo/domReady!"],@H_403_60@
function(on,topic,domConstruct,dom) {@H_403_60@
var alertButton = dom.byId("alertButton"),@H_403_60@
createAlert = dom.byId("createAlert");@H_403_60@
@H_403_60@
on(alertButton,"click",function() {@H_403_60@
// When this button is clicked,@H_403_60@
// publish to the "alertUser" topic@H_403_60@
topic.publish("alertUser","I am alerting you.");@H_403_60@
});@H_403_60@
on(createAlert,function(evt){@H_403_60@
// Create another button@H_403_60@
var anotherButton = domConstruct.create("button",{@H_403_60@
innerHTML: "Another alert button"@H_403_60@
},createAlert,"after");@H_403_60@
// When the other button is clicked,@H_403_60@
// publish to the "alertUser" topic@H_403_60@
on(anotherButton,function(evt){@H_403_60@
topic.publish("alertUser","I am also alerting you.");@H_403_60@
});@H_403_60@
});@H_403_60@
@H_403_60@
// Register the alerting routine with the "alertUser" topic.@H_403_60@
topic.subscribe("alertUser",function(text){@H_403_60@
alert(text);@H_403_60@
});@H_403_60@
});@H_403_60@
</script>@H_403_60@