reducing functionality of Events class

This commit is contained in:
Ezequiel Bergamaschi 2014-09-27 14:35:40 -03:00
parent 8b0bd46f4d
commit 27149b0870

View File

@ -16,11 +16,6 @@ mindplot.Events = new Class({
return this; return this;
}, },
addEvents: function(events){
for (var type in events) this.addEvent(type, events[type]);
return this;
},
fireEvent: function(type, args, delay){ fireEvent: function(type, args, delay){
type = this._removeOn(type); type = this._removeOn(type);
var events = this.$events[type]; var events = this.$events[type];
@ -38,24 +33,7 @@ mindplot.Events = new Class({
var events = this.$events[type]; var events = this.$events[type];
if (events && !fn.internal){ if (events && !fn.internal){
var index = events.indexOf(fn); var index = events.indexOf(fn);
if (index != -1) delete events[index]; if (index != -1) events.splice(index, 1);
}
return this;
},
removeEvents: function(events){
var type;
if (typeOf(events) == 'object'){
for (type in events) this.removeEvent(type, events[type]);
return this;
}
if (events) events = removeOn(events);
for (type in this.$events){
if (events && events != type) continue;
var fns = this.$events[type];
for (var i = fns.length; i--;) if (i in fns){
this.removeEvent(type, fns[i]);
}
} }
return this; return this;
} }