-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Remove use of Module['websocket']. NFC
#22774
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
Conversation
d877393 to
dc4486e
Compare
dc4486e to
2deb831
Compare
| if (runtimeConfig && null === Module['websocket']['subprotocol']) { | ||
| subProtocols = 'null'; | ||
| opts = undefined; | ||
| } |
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.
Separate change? (I don't seem to see this code moved anywhere else.)
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.
I specially handle the === null case above.
We can still receive the initial value for websocket from the Module object but there is not need to continue to access it via the Module object.
2deb831 to
aee468c
Compare
| this._callbacks[event].call(this, param); | ||
| } | ||
| }; | ||
| (Module['websocket'] ??= {})['on'] = SOCKFS.on; |
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.
Do we not need 'emit' as well? Looks like before we had both exported.
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.
No, I don't think so. The emit for for internal use to send the message. The on is what users would use to register callback.
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.
You can see that the on property is quoted so that closure won't minify it but the emit helper function is not.
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.
| if (SOCKFS.websocketArgs['subprotocol']) { | ||
| subProtocols = SOCKFS.websocketArgs['subprotocol']; | ||
| } else if (SOCKFS.websocketArgs['subprotocol'] === null) { | ||
| subProtocols = 'null' |
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.
| subProtocols = 'null' | |
| subProtocols = 'null'; |
We can still receive the initial value for websocket from the Module object but there is not need to continue to access it via the Module object.