-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Calypsoify-iframe: Janitorial types and fixes #39057
Conversation
const { | ||
port1: iframePortObject, | ||
port2: transferredPortObject, | ||
} = new globalThis.MessageChannel(); |
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.
globalThis
is a code change here.
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.
How would you compare adding globalThis
vs. something like /* global MessageChannel */
at the top of the file?
Im guessing there isn't any functional difference between the two and since we only have 1 instance of MessageChannel
being called in the file it makes more sense to call it off the globalThis
here explicitly?
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Async-loaded Components (~9063 bytes added 📈 [gzipped])
React components that are loaded lazily, when a certain part of UI is displayed for the first time. Legend What is parsed and gzip size?Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory. Generated by performance advisor bot at iscalypsofastyet.com. |
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.
const { | ||
port1: iframePortObject, | ||
port2: transferredPortObject, | ||
} = new globalThis.MessageChannel(); |
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.
How would you compare adding globalThis
vs. something like /* global MessageChannel */
at the top of the file?
Im guessing there isn't any functional difference between the two and since we only have 1 instance of MessageChannel
being called in the file it makes more sense to call it off the globalThis
here explicitly?
bf158e9
to
3d9cbe5
Compare
This was dropped in rebase because it was handled in #38986. There are some details there: https://github.com/Automattic/wp-calypso/pull/38986/files#r369949284 In short, we' started to discourage usage of globals because there are too many and we've seen usage lead to bugs. They should be prefixed with |
Indeed, I intended to fix the bare minimum while providing an example of how they can be added. They seem to be fixed in my editor, you may need to restart the language server, restart your editor, or force it to reparse the JSdoc in some way. In VS Code, there's a command |
Rebased to fix conflicts. |
Landed in #39048 |
Some fixes and improvements to reduce type issues in calypsoify-iframe. It would be great to resurrect #32872
Inspired by #39048 (review)
globalThis
for browser globals.Testing instructions