Skip to content

Instantly share code, notes, and snippets.

@roblg
Created August 13, 2011 01:06
Show Gist options
  • Save roblg/1143350 to your computer and use it in GitHub Desktop.
Save roblg/1143350 to your computer and use it in GitHub Desktop.
Connect to every event on a dojo widget, and log when the event is fired.
for (var k in widget) {
// connect to functions that start with 'on'. Seems pretty close to what we want...
if (k.substring(0,2) === 'on' && typeof this.editor[k] == 'function') {
(dojo.hitch(this, function (func) {
this.connect(widget, func, function () {
console.log("editor." + func);
});
}))(k);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment