dojo on versus dojo aspect example
http://stackoverflow.com/questions/31528245/dojo-on-does-not-catch-titlepane-toggle-event
by schlomm
HTML
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.9.0/dijit/themes/claro/claro.css">
<p>Expand / collapse the title pane</p>
<span id="pane" data-dojo-type="dijit/TitlePane"/>
JavaScript
require([
"dojo/parser",
"dojo/on",
"dojo/aspect",
"dijit/registry",
"dijit/TitlePane",
"dojo/domReady!"
], function (parser, on, aspect, registry, TitlePane) {
parser.parse();
var p = registry.byId("pane");
//available events: Click, mouseover, ...https://dojotoolkit.org/reference-guide/1.10/quickstart/events.html#dom-events
on(p, "toggle", function() {
alert("toggle isn't an event, so this doesn't work");
});
aspect.after(p, "toggle", function() {
alert("it's a normal method on an object, so use aspect.");
});
});