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
Allow passing optional window into getMode #4057
Conversation
export function getMode() { | ||
if (mode) { | ||
return mode; | ||
export function getMode(opt_win) { |
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.
Will this have any effect on us being able to DCE this code?
/cc @erwinmombay
This is LGTM as soon as @erwinmombay confirms no problems with DCE. |
i tested this out, LGTM |
Can anyone help me with the type errors?
|
looking |
@@ -43,59 +40,57 @@ let fullVersion = ''; | |||
|
|||
/** | |||
* Provides info about the current app. | |||
* @param {?Window=} win |
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.
just need to change this into opt_win (the name)
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.
😳
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.
doing that though seems to make it type check more modules which we haven't fixed yet O_O
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.
nvm, i ran the command wrong 💨
Instead of some magical private global.
5a18922
to
437545c
Compare
* Allow passing optional window into getMode * Cache mode on the window object Instead of some magical private global. * Fix tests * Fix isLocalDev detection * Tests * Linting * Stupid type checking * Fix presubmit error * Fix lingering tests
Separated from #4037 on @dvoytenko's suggestion.
Allows the
win
context to be (optionally) passed intogetMode
. This important for use in ServiceWorkers since they do not have awindow
variable.