Skip to content

Commit

Permalink
Fix spacing in EventTarget.js
Browse files Browse the repository at this point in the history
  • Loading branch information
nschonni committed Aug 16, 2013
1 parent 79e9338 commit 36851b9
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/util/EventTarget.js
Expand Up @@ -13,7 +13,7 @@ function EventTarget(){
* @property _listeners
* @private
*/
this._listeners = {};
this._listeners = {};
}

EventTarget.prototype = {
Expand All @@ -35,34 +35,34 @@ EventTarget.prototype = {

this._listeners[type].push(listener);
},

/**
* Fires an event based on the passed-in object.
* @param {Object|String} event An object with at least a 'type' attribute
* or a string indicating the event name.
* @return {void}
* @method fire
*/
*/
fire: function(event){
if (typeof event == "string"){
event = { type: event };
}
if (typeof event.target != "undefined"){
event.target = this;
}

if (typeof event.type == "undefined"){
throw new Error("Event object missing 'type' property.");
}

if (this._listeners[event.type]){

//create a copy of the array and use that so listeners can't chane
var listeners = this._listeners[event.type].concat();
for (var i=0, len=listeners.length; i < len; i++){
listeners[i].call(this, event);
}
}
}
},

/**
Expand All @@ -81,8 +81,8 @@ EventTarget.prototype = {
break;
}
}
}


}
}
};

0 comments on commit 36851b9

Please sign in to comment.