if(!context.getThis()){ throw new Error("You must use Context.setObject(instance)"); } this.onAddEvent(this.getParent(), type, fn); var resolved = fn; if(dojo.isArray(args)){ resolved = function(e){ this[fn].apply(this, [e].concat(args)); } } return dojo.connect(this.getParent(), type, context.getThis(), resolved);