| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 3eeeea4 commit 66e1adf
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,7 +21,12 @@ | |||
| 21 | 21 | ||
| 22 | 22 | 'use strict'; | |
| 23 | 23 | ||
| 24 | - const { Object } = primordials; | ||
| 24 | + const { | ||
| 25 | + Object: { | ||
| 26 | + defineProperty: ObjectDefineProperty, | ||
| 27 | + setPrototypeOf: ObjectSetPrototypeOf | ||
| 28 | + } | ||
| 29 | + } = primordials; | ||
| 25 | 30 | ||
| 26 | 31 | const EventEmitter = require('events'); | |
| 27 | 32 | const stream = require('stream'); | |
@@ -336,7 +341,7 @@ function Socket(options) { | |||
| 336 | 341 | // makeSyncWrite adjusts this value like the original handle would, so | |
| 337 | 342 | // we need to let it do that by turning it into a writable, own | |
| 338 | 343 | // property. | |
| 339 | - Object.defineProperty(this._handle, 'bytesWritten', { | ||
| 344 | + ObjectDefineProperty(this._handle, 'bytesWritten', { | ||
| 340 | 345 | value: 0, writable: true | |
| 341 | 346 | }); | |
| 342 | 347 | } | |
@@ -372,8 +377,8 @@ function Socket(options) { | |||
| 372 | 377 | this[kBytesRead] = 0; | |
| 373 | 378 | this[kBytesWritten] = 0; | |
| 374 | 379 | } | |
| 375 | - Object.setPrototypeOf(Socket.prototype, stream.Duplex.prototype); | ||
| 376 | - Object.setPrototypeOf(Socket, stream.Duplex); | ||
| 380 | + ObjectSetPrototypeOf(Socket.prototype, stream.Duplex.prototype); | ||
| 381 | + ObjectSetPrototypeOf(Socket, stream.Duplex); | ||
| 377 | 382 | ||
| 378 | 383 | // Refresh existing timeouts. | |
| 379 | 384 | Socket.prototype._unrefTimer = function _unrefTimer() { | |
@@ -503,21 +508,21 @@ Socket.prototype.address = function() { | |||
| 503 | 508 | }; | |
| 504 | 509 | ||
| 505 | 510 | ||
| 506 | - Object.defineProperty(Socket.prototype, '_connecting', { | ||
| 511 | + ObjectDefineProperty(Socket.prototype, '_connecting', { | ||
| 507 | 512 | get: function() { | |
| 508 | 513 | return this.connecting; | |
| 509 | 514 | } | |
| 510 | 515 | }); | |
| 511 | 516 | ||
| 512 | - Object.defineProperty(Socket.prototype, 'pending', { | ||
| 517 | + ObjectDefineProperty(Socket.prototype, 'pending', { | ||
| 513 | 518 | get() { | |
| 514 | 519 | return !this._handle || this.connecting; | |
| 515 | 520 | }, | |
| 516 | 521 | configurable: true | |
| 517 | 522 | }); | |
| 518 | 523 | ||
| 519 | 524 | ||
| 520 | - Object.defineProperty(Socket.prototype, 'readyState', { | ||
| 525 | + ObjectDefineProperty(Socket.prototype, 'readyState', { | ||
| 521 | 526 | get: function() { | |
| 522 | 527 | if (this.connecting) { | |
| 523 | 528 | return 'opening'; | |
@@ -534,15 +539,15 @@ Object.defineProperty(Socket.prototype, 'readyState', { | |||
| 534 | 539 | }); | |
| 535 | 540 | ||
| 536 | 541 | ||
| 537 | - Object.defineProperty(Socket.prototype, 'bufferSize', { | ||
| 538 | - get: function() { // eslint-disable-line getter-return | ||
| 542 | + ObjectDefineProperty(Socket.prototype, 'bufferSize', { | ||
| 543 | + get: function() { | ||
| 539 | 544 | if (this._handle) { | |
| 540 | 545 | return this[kLastWriteQueueSize] + this.writableLength; | |
| 541 | 546 | } | |
| 542 | 547 | } | |
| 543 | 548 | }); | |
| 544 | 549 | ||
| 545 | - Object.defineProperty(Socket.prototype, kUpdateTimer, { | ||
| 550 | + ObjectDefineProperty(Socket.prototype, kUpdateTimer, { | ||
| 546 | 551 | get: function() { | |
| 547 | 552 | return this._unrefTimer; | |
| 548 | 553 | } | |
@@ -690,7 +695,7 @@ Socket.prototype._getpeername = function() { | |||
| 690 | 695 | }; | |
| 691 | 696 | ||
| 692 | 697 | function protoGetter(name, callback) { | |
| 693 | - Object.defineProperty(Socket.prototype, name, { | ||
| 698 | + ObjectDefineProperty(Socket.prototype, name, { | ||
| 694 | 699 | configurable: false, | |
| 695 | 700 | enumerable: true, | |
| 696 | 701 | get: callback | |
@@ -1162,7 +1167,7 @@ function Server(options, connectionListener) { | |||
| 1162 | 1167 | ||
| 1163 | 1168 | this._connections = 0; | |
| 1164 | 1169 | ||
| 1165 | - Object.defineProperty(this, 'connections', { | ||
| 1170 | + ObjectDefineProperty(this, 'connections', { | ||
| 1166 | 1171 | get: deprecate(() => { | |
| 1167 | 1172 | ||
| 1168 | 1173 | if (this._usingWorkers) { | |
@@ -1186,8 +1191,8 @@ function Server(options, connectionListener) { | |||
| 1186 | 1191 | this.allowHalfOpen = options.allowHalfOpen || false; | |
| 1187 | 1192 | this.pauseOnConnect = !!options.pauseOnConnect; | |
| 1188 | 1193 | } | |
| 1189 | - Object.setPrototypeOf(Server.prototype, EventEmitter.prototype); | ||
| 1190 | - Object.setPrototypeOf(Server, EventEmitter); | ||
| 1194 | + ObjectSetPrototypeOf(Server.prototype, EventEmitter.prototype); | ||
| 1195 | + ObjectSetPrototypeOf(Server, EventEmitter); | ||
| 1191 | 1196 | ||
| 1192 | 1197 | ||
| 1193 | 1198 | function toNumber(x) { return (x = Number(x)) >= 0 ? x : false; } | |
@@ -1491,7 +1496,7 @@ function lookupAndListen(self, port, address, backlog, exclusive, flags) { | |||
| 1491 | 1496 | }); | |
| 1492 | 1497 | } | |
| 1493 | 1498 | ||
| 1494 | - Object.defineProperty(Server.prototype, 'listening', { | ||
| 1499 | + ObjectDefineProperty(Server.prototype, 'listening', { | ||
| 1495 | 1500 | get: function() { | |
| 1496 | 1501 | return !!this._handle; | |
| 1497 | 1502 | }, | |
@@ -1648,12 +1653,12 @@ function emitCloseNT(self) { | |||
| 1648 | 1653 | ||
| 1649 | 1654 | // Legacy alias on the C++ wrapper object. This is not public API, so we may | |
| 1650 | 1655 | // want to runtime-deprecate it at some point. There's no hurry, though. | |
| 1651 | - Object.defineProperty(TCP.prototype, 'owner', { | ||
| 1656 | + ObjectDefineProperty(TCP.prototype, 'owner', { | ||
| 1652 | 1657 | get() { return this[owner_symbol]; }, | |
| 1653 | 1658 | set(v) { return this[owner_symbol] = v; } | |
| 1654 | 1659 | }); | |
| 1655 | 1660 | ||
| 1656 | - Object.defineProperty(Socket.prototype, '_handle', { | ||
| 1661 | + ObjectDefineProperty(Socket.prototype, '_handle', { | ||
| 1657 | 1662 | get() { return this[kHandle]; }, | |
| 1658 | 1663 | set(v) { return this[kHandle] = v; } | |
| 1659 | 1664 | }); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments