-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
js: de-class-ify node:net.Socket #17997
base: main
Are you sure you want to change the base?
Conversation
if (typeof onread !== "object") { | ||
throw new TypeError("onread must be an object"); | ||
} | ||
if (typeof onread.callback !== "function") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should it be validateFunction
} | ||
if ( | ||
// TLSSocket already created a socket and is forwarding it here. This is a private API. | ||
!(socket && $isObject(socket) && socket instanceof Duplex) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a way to avoid the instanceof
return this; | ||
}; | ||
|
||
Object.defineProperty(Socket.prototype, "remoteAddress", { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are these also read only in node?
@@ -1470,7 +1452,7 @@ Server.prototype.listen = function listen(port, hostname, onListen) { | |||
tls.rejectUnauthorized = false; | |||
} | |||
} else { | |||
options.InternalSocketClass = SocketClass; | |||
options.InternalSocketClass = Socket; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a real thing? InternalSocketClass? If this was ment as an internal api, can we use a symbol?
@@ -1726,7 +1708,7 @@ export default { | |||
isIPv4, | |||
isIPv6, | |||
Socket, | |||
[Symbol.for("::bunternal::")]: SocketClass, | |||
[Symbol.for("::bunternal::")]: Socket, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove this symbol now that we have private symbols?
No description provided.