@@ -50,10 +50,10 @@ class EventEmitter {
5050 * listener
5151 */
5252 addListener ( eventType , listener , context ) {
53- return ( this . _subscriber . addSubscription (
53+ return this . _subscriber . addSubscription (
5454 eventType ,
55- new EmitterSubscription ( this , this . _subscriber , listener , context )
56- ) ) ;
55+ new EmitterSubscription ( this , this . _subscriber , listener , context ) ,
56+ ) ;
5757 }
5858
5959 /**
@@ -96,19 +96,19 @@ class EventEmitter {
9696 *
9797 * @example
9898 * var subscription = emitter.addListenerMap({
99- * someEvent: function(data, event) {
100- * console.log(data);
101- * emitter.removeCurrentListener();
102- * }
103- * });
99+ * someEvent: function(data, event) {
100+ * console.log(data);
101+ * emitter.removeCurrentListener();
102+ * }
103+ * });
104104 *
105105 * emitter.emit('someEvent', 'abc'); // logs 'abc'
106106 * emitter.emit('someEvent', 'def'); // does not log anything
107107 */
108108 removeCurrentListener ( ) {
109109 invariant (
110110 ! ! this . _currentSubscription ,
111- 'Not in an emitting cycle; there is no current subscription'
111+ 'Not in an emitting cycle; there is no current subscription' ,
112112 ) ;
113113 this . removeSubscription ( this . _currentSubscription ) ;
114114 }
@@ -120,7 +120,7 @@ class EventEmitter {
120120 removeSubscription ( subscription ) {
121121 invariant (
122122 subscription . emitter === this ,
123- 'Subscription does not belong to this emitter.'
123+ 'Subscription does not belong to this emitter.' ,
124124 ) ;
125125 this . _subscriber . removeSubscription ( subscription ) ;
126126 }
@@ -133,8 +133,10 @@ class EventEmitter {
133133 * @returns {array }
134134 */
135135 listeners ( eventType ) {
136- const subscriptions = ( this . _subscriber . getSubscriptionsForType ( eventType ) ) ;
137- return subscriptions ? subscriptions . map ( subscription => subscription . listener ) : [ ] ;
136+ const subscriptions = this . _subscriber . getSubscriptionsForType ( eventType ) ;
137+ return subscriptions
138+ ? subscriptions . map ( subscription => subscription . listener )
139+ : [ ] ;
138140 }
139141
140142 /**
@@ -146,13 +148,13 @@ class EventEmitter {
146148 *
147149 * @example
148150 * emitter.addListener('someEvent', function(message) {
149- * console.log(message);
150- * });
151+ * console.log(message);
152+ * });
151153 *
152154 * emitter.emit('someEvent', 'abc'); // logs 'abc'
153155 */
154156 emit ( eventType ) {
155- const subscriptions = ( this . _subscriber . getSubscriptionsForType ( eventType ) ) ;
157+ const subscriptions = this . _subscriber . getSubscriptionsForType ( eventType ) ;
156158 if ( subscriptions ) {
157159 for ( let i = 0 , l = subscriptions . length ; i < l ; i ++ ) {
158160 const subscription = subscriptions [ i ] ;
@@ -162,7 +164,7 @@ class EventEmitter {
162164 this . _currentSubscription = subscription ;
163165 subscription . listener . apply (
164166 subscription . context ,
165- Array . prototype . slice . call ( arguments , 1 )
167+ Array . prototype . slice . call ( arguments , 1 ) ,
166168 ) ;
167169 }
168170 }
@@ -179,12 +181,12 @@ class EventEmitter {
179181 *
180182 * @example
181183 * emitter.removeListener('someEvent', function(message) {
182- * console.log(message);
183- * }); // removes the listener if already registered
184+ * console.log(message);
185+ * }); // removes the listener if already registered
184186 *
185187 */
186188 removeListener ( eventType , listener ) {
187- const subscriptions = ( this . _subscriber . getSubscriptionsForType ( eventType ) ) ;
189+ const subscriptions = this . _subscriber . getSubscriptionsForType ( eventType ) ;
188190 if ( subscriptions ) {
189191 for ( let i = 0 , l = subscriptions . length ; i < l ; i ++ ) {
190192 const subscription = subscriptions [ i ] ;
0 commit comments