Skip to content

Instantly share code, notes, and snippets.

@ericf
Created May 11, 2011 07:33
Show Gist options
  • Select an option

  • Save ericf/966053 to your computer and use it in GitHub Desktop.

Select an option

Save ericf/966053 to your computer and use it in GitHub Desktop.
Y.eventMethod = function (receiver, method, config) {
config || (config = {});
var original = receiver[method] || noop,
type = config.type || method;
config.defaultFn = config.defaultFn || function(e){
original.apply(this, e.args);
};
receiver[method] = function(){
this._evented || (this._evented = {});
if ( ! this._evented[method]) {
this.publish(type, config);
this._evented[method] = config.defaultFn;
}
this.fire(type, { args: Y.Array(arguments, 0, true) });
return this;
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment