File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -306,10 +306,25 @@ EventEmitter.prototype.prependListener =
306306 } ;
307307
308308function onceWrapper ( ) {
309- this . target . removeListener ( this . type , this . wrapFn ) ;
310309 if ( ! this . fired ) {
310+ this . target . removeListener ( this . type , this . wrapFn ) ;
311311 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+ }
313328 }
314329}
315330
You can’t perform that action at this time.
0 commit comments