Skip to content

Instantly share code, notes, and snippets.

@phiggins42
Created May 7, 2010 15:16
Show Gist options
  • Save phiggins42/393545 to your computer and use it in GitHub Desktop.
Save phiggins42/393545 to your computer and use it in GitHub Desktop.
dojo.extend(dijit._Widget, {
on: function(ev, cb, scp){
if(scp){ cb = dojo.hitch(cb, scp) }
this.connect(this, ev, cb);
return this; // or return this.connect(...), can't decide
}
});
// examples:
//
// new dialog().on("show", function(){
// this.hide();
// })
//
// var dialog = new Thinger();
// dialog.on("show", "hide").on("hide", "show");
//
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment