@@ -299,34 +299,22 @@ function interceptAddListener (ee, fn) {
299
299
var _on = ee . on
300
300
301
301
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
+ }
307
307
}
308
308
309
309
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
+ }
315
315
}
316
316
317
317
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
- }
330
318
}
331
319
332
320
/**
@@ -339,34 +327,22 @@ function interceptRemoveListener (ee, fn) {
339
327
var _off = ee . off
340
328
341
329
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
+ } ;
347
335
}
348
336
349
337
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
+ } ;
355
343
}
356
344
357
345
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
- }
370
346
}
371
347
372
348
/**
0 commit comments