@@ -299,34 +299,22 @@ function interceptAddListener (ee, fn) {
299299 var _on = ee . on
300300
301301 if ( _addListener ) {
302- Object . defineProperty ( ee , ' addListener' , {
303- configurable : true ,
304- value : addListener ,
305- writable : true
306- } )
302+ ee . addListener = function addListener ( type , listener ) {
303+ return fn . call ( this , type , listener ) === false
304+ ? _addListener . call ( this , type , listener )
305+ : this
306+ }
307307 }
308308
309309 if ( _on ) {
310- Object . defineProperty ( ee , 'on' , {
311- configurable : true ,
312- value : on ,
313- writable : true
314- } )
310+ ee . on = function on ( type , listener ) {
311+ return fn . call ( this , type , listener ) === false
312+ ? _on . call ( this , type , listener )
313+ : this
314+ }
315315 }
316316
317317 return _addListener || _on || noop
318-
319- function addListener ( type , listener ) {
320- return fn . call ( this , type , listener ) === false
321- ? _addListener . call ( this , type , listener )
322- : this
323- }
324-
325- function on ( type , listener ) {
326- return fn . call ( this , type , listener ) === false
327- ? _on . call ( this , type , listener )
328- : this
329- }
330318}
331319
332320/**
@@ -339,34 +327,22 @@ function interceptRemoveListener (ee, fn) {
339327 var _off = ee . off
340328
341329 if ( _removeListener ) {
342- Object . defineProperty ( ee , ' removeListener' , {
343- configurable : true ,
344- value : removeListener ,
345- writable : true
346- } )
330+ ee . removeListener = function removeListener ( type , listener ) {
331+ return fn . call ( this , type , listener ) === false
332+ ? _removeListener . call ( this , type , listener )
333+ : this ;
334+ } ;
347335 }
348336
349337 if ( _off ) {
350- Object . defineProperty ( ee , ' off' , {
351- configurable : true ,
352- value : off ,
353- writable : true
354- } )
338+ ee . off = function off ( type , listener ) {
339+ return fn . call ( this , type , listener ) === false
340+ ? _off . call ( this , type , listener )
341+ : this ;
342+ } ;
355343 }
356344
357345 return _removeListener || _off || noop
358-
359- function removeListener ( type , listener ) {
360- return fn . call ( this , type , listener ) === false
361- ? _removeListener . call ( this , type , listener )
362- : this
363- }
364-
365- function off ( type , listener ) {
366- return fn . call ( this , type , listener ) === false
367- ? _off . call ( this , type , listener )
368- : this
369- }
370346}
371347
372348/**
0 commit comments