| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent b38d8d6 commit 4179c70
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -415,30 +415,31 @@ ChildProcess.prototype.unref = function() { | |||
| 415 | 415 | if (this._handle) this._handle.unref(); | |
| 416 | 416 | }; | |
| 417 | 417 | ||
| 418 | + class Control extends EventEmitter { | ||
| 419 | + constructor(channel) { | ||
| 420 | + super(); | ||
| 421 | + this.channel = channel; | ||
| 422 | + this.refs = 0; | ||
| 423 | + } | ||
| 424 | + ref() { | ||
| 425 | + if (++this.refs === 1) { | ||
| 426 | + this.channel.ref(); | ||
| 427 | + } | ||
| 428 | + } | ||
| 429 | + unref() { | ||
| 430 | + if (--this.refs === 0) { | ||
| 431 | + this.channel.unref(); | ||
| 432 | + this.emit('unref'); | ||
| 433 | + } | ||
| 434 | + } | ||
| 435 | + } | ||
| 418 | 436 | ||
| 419 | 437 | function setupChannel(target, channel) { | |
| 420 | 438 | target._channel = 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 = ''; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments