vendor/assets/javascripts/xooie/event_handler.js in xooie-1.0.6 vs vendor/assets/javascripts/xooie/event_handler.js in xooie-1.0.7
- old
+ new
@@ -45,12 +45,13 @@
}
formattedType = format(type, this.namespace);
if (helpers.isUndefined(this.handlers[formattedType])) {
- this.handlers[formattedType] = function (e) {
- self.fire(e, this, arguments);
+ this.handlers[formattedType] = function () {
+ [].splice.call(arguments, 1, 0, this);
+ self.fire.apply(self, arguments);
};
}
if (helpers.isUndefined(this._callbacks[type])) {
this._callbacks[type] = $.Callbacks('unique');
@@ -65,16 +66,18 @@
if (!helpers.isUndefined(this._callbacks[type])) {
this._callbacks[type].empty();
}
};
- EventHandler.prototype.fire = function (event, context, args) {
+ EventHandler.prototype.fire = function (event) {
if (event.namespace && event.namespace !== this.namespace) {
return;
}
+ var args = [].slice.call(arguments, 1);
+
if (!helpers.isUndefined(this._callbacks[event.type])) {
- this._callbacks[event.type].fireWith(context, args);
+ this._callbacks[event.type].fireWith.apply(this._callbacks[event.type].fireWith, args);
}
};
return EventHandler;
});