File tree 1 file changed +19
-18
lines changed
1 file changed +19
-18
lines changed Original file line number Diff line number Diff line change @@ -407,6 +407,24 @@ ChildProcess.prototype.unref = function() {
407
407
if ( this . _handle ) this . _handle . unref ( ) ;
408
408
} ;
409
409
410
+ class Control extends EventEmitter {
411
+ constructor ( channel ) {
412
+ super ( ) ;
413
+ this . channel = channel ;
414
+ this . refs = 0 ;
415
+ }
416
+ ref ( ) {
417
+ if ( ++ this . refs === 1 ) {
418
+ this . channel . ref ( ) ;
419
+ }
420
+ }
421
+ unref ( ) {
422
+ if ( -- this . refs === 0 ) {
423
+ this . channel . unref ( ) ;
424
+ this . emit ( 'unref' ) ;
425
+ }
426
+ }
427
+ }
410
428
411
429
function setupChannel ( target , channel ) {
412
430
target . channel = channel ;
@@ -421,24 +439,7 @@ function setupChannel(target, channel) {
421
439
target . _handleQueue = null ;
422
440
target . _pendingHandle = null ;
423
441
424
- const control = new class extends EventEmitter {
425
- constructor ( ) {
426
- super ( ) ;
427
- this . channel = channel ;
428
- this . refs = 0 ;
429
- }
430
- ref ( ) {
431
- if ( ++ this . refs === 1 ) {
432
- this . channel . ref ( ) ;
433
- }
434
- }
435
- unref ( ) {
436
- if ( -- this . refs === 0 ) {
437
- this . channel . unref ( ) ;
438
- this . emit ( 'unref' ) ;
439
- }
440
- }
441
- } ( ) ;
442
+ const control = new Control ( channel ) ;
442
443
443
444
var decoder = new StringDecoder ( 'utf8' ) ;
444
445
var jsonBuffer = '' ;
You can’t perform that action at this time.
0 commit comments