我正在尝试将此代码块转换为 Lo-Dash:
if(!event && callback){
for(var ev in this._events){
for (var i = 0; i < this._events[ev].length; i++) {
if(this._events[ev][i].callback === callback){
this._events[ev].splice(i, 1);
}
}
}
return;
}
我已经尝试过了,但我无法让它工作:
if(!event && callback){
_.each(this._events, function(ev){
_.each(ev, function(trigger, i, ev){
if(trigger.callback === callback) ev.splice(i, 1);
});
});
return;
}
this._events
结构是这样的:
this._events = {
ev1: [
{callback: functions(){....}},
{callback: functions(){....}}
],
ev2....
}