File tree 1 file changed +17
-2
lines changed
1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -306,10 +306,25 @@ EventEmitter.prototype.prependListener =
306
306
} ;
307
307
308
308
function onceWrapper ( ) {
309
- this . target . removeListener ( this . type , this . wrapFn ) ;
310
309
if ( ! this . fired ) {
310
+ this . target . removeListener ( this . type , this . wrapFn ) ;
311
311
this . fired = true ;
312
- this . listener . apply ( this . target , arguments ) ;
312
+ switch ( arguments . length ) {
313
+ case 0 :
314
+ return this . listener . call ( this . target ) ;
315
+ case 1 :
316
+ return this . listener . call ( this . target , arguments [ 0 ] ) ;
317
+ case 2 :
318
+ return this . listener . call ( this . target , arguments [ 0 ] , arguments [ 1 ] ) ;
319
+ case 3 :
320
+ return this . listener . call ( this . target , arguments [ 0 ] , arguments [ 1 ] ,
321
+ arguments [ 2 ] ) ;
322
+ default :
323
+ const args = new Array ( arguments . length ) ;
324
+ for ( var i = 0 ; i < args . length ; ++ i )
325
+ args [ i ] = arguments [ i ] ;
326
+ this . listener . apply ( this . target , args ) ;
327
+ }
313
328
}
314
329
}
315
330
You can’t perform that action at this time.
0 commit comments