File tree 1 file changed +10
-10
lines changed
1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ function EventTarget(){
13
13
* @property _listeners
14
14
* @private
15
15
*/
16
- this . _listeners = { } ;
16
+ this . _listeners = { } ;
17
17
}
18
18
19
19
EventTarget . prototype = {
@@ -35,34 +35,34 @@ EventTarget.prototype = {
35
35
36
36
this . _listeners [ type ] . push ( listener ) ;
37
37
} ,
38
-
38
+
39
39
/**
40
40
* Fires an event based on the passed-in object.
41
41
* @param {Object|String } event An object with at least a 'type' attribute
42
42
* or a string indicating the event name.
43
43
* @return {void }
44
44
* @method fire
45
- */
45
+ */
46
46
fire : function ( event ) {
47
47
if ( typeof event == "string" ) {
48
48
event = { type : event } ;
49
49
}
50
50
if ( typeof event . target != "undefined" ) {
51
51
event . target = this ;
52
52
}
53
-
53
+
54
54
if ( typeof event . type == "undefined" ) {
55
55
throw new Error ( "Event object missing 'type' property." ) ;
56
56
}
57
-
57
+
58
58
if ( this . _listeners [ event . type ] ) {
59
-
59
+
60
60
//create a copy of the array and use that so listeners can't chane
61
61
var listeners = this . _listeners [ event . type ] . concat ( ) ;
62
62
for ( var i = 0 , len = listeners . length ; i < len ; i ++ ) {
63
63
listeners [ i ] . call ( this , event ) ;
64
64
}
65
- }
65
+ }
66
66
} ,
67
67
68
68
/**
@@ -81,8 +81,8 @@ EventTarget.prototype = {
81
81
break ;
82
82
}
83
83
}
84
-
85
-
86
- }
84
+
85
+
86
+ }
87
87
}
88
88
} ;
You can’t perform that action at this time.
0 commit comments