Skip to content

Instantly share code, notes, and snippets.

@ericf
Created May 3, 2011 17:28
Show Gist options
  • Select an option

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

Select an option

Save ericf/953774 to your computer and use it in GitHub Desktop.
function eventWrap (event, config) {
var proto = this.prototype;
proto[event] = function(){
if (isString(config)) { config = isFunction(this[config]) ? this[config] : null; }
if (isFunction(config)) { config = { defaultFn: config }; }
this.publish(event, config);
function fireEvent () {
this.fire(event, { args: Y.Array(arguments) });
return this;
}
proto[event] = fireEvent;
return fireEvent.apply(this, arguments);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment