Skip to content

Commit

Permalink
Issue #18: Loop on array indices instead of for..in
Browse files Browse the repository at this point in the history
  • Loading branch information
brianchirls committed Nov 29, 2012
1 parent d881366 commit 3cfd417
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions recorder.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,12 @@ var Recorder = {

triggerEvent: function(eventName, arg0, arg1){
Recorder._executeInWindowContext(function(){
for(var cb in Recorder._events[eventName]){
if(Recorder._events[eventName][cb]){
Recorder._events[eventName][cb].apply(Recorder, [arg0, arg1]);
if (!Recorder._events[eventName]) {
return;
}
for(var i = 0, len = Recorder._events[eventName].length; i < len; i++){
if(Recorder._events[eventName][i]){
Recorder._events[eventName][i].apply(Recorder, [arg0, arg1]);
}
}
});
Expand Down

0 comments on commit 3cfd417

Please sign in to comment.