@@ -280,24 +280,33 @@ Object.defineProperty(EventSource, 'CLOSED', { enumerable: true, value: 2});
280
280
/**
281
281
* Emulates the W3C Browser based WebSocket interface using addEventListener.
282
282
*
283
- * @param {String } method Listen for an event
283
+ * @param {String } type A string representing the event type to listen out for
284
284
* @param {Function } listener callback
285
285
* @see https://developer.mozilla.org/en/DOM/element.addEventListener
286
286
* @see http://dev.w3.org/html5/websockets/#the-websocket-interface
287
287
* @api public
288
288
*/
289
- EventSource . prototype . addEventListener = function addEventListener ( method , listener ) {
289
+ EventSource . prototype . addEventListener = function addEventListener ( type , listener ) {
290
290
if ( typeof listener === 'function' ) {
291
291
// store a reference so we can return the original function again
292
292
listener . _listener = listener ;
293
- this . on ( method , listener ) ;
293
+ this . on ( type , listener ) ;
294
294
}
295
295
} ;
296
296
297
- EventSource . prototype . removeEventListener = function removeEventListener ( method , listener ) {
297
+ /**
298
+ * Emulates the W3C Browser based WebSocket interface using removeEventListener.
299
+ *
300
+ * @param {String } type A string representing the event type to remove
301
+ * @param {Function } listener callback
302
+ * @see https://developer.mozilla.org/en/DOM/element.removeEventListener
303
+ * @see http://dev.w3.org/html5/websockets/#the-websocket-interface
304
+ * @api public
305
+ */
306
+ EventSource . prototype . removeEventListener = function removeEventListener ( type , listener ) {
298
307
if ( typeof listener === 'function' ) {
299
308
listener . _listener = undefined ;
300
- this . off ( method , listener ) ;
309
+ this . removeListener ( type , listener ) ;
301
310
}
302
311
} ;
303
312
0 commit comments