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
Bugfix/clean up #24
Bugfix/clean up #24
Conversation
21353a9
to
25f85be
Compare
README.md
Outdated
@@ -188,31 +187,31 @@ const Component = React.lazy(() => { | |||
|
|||
let module; | |||
switch (effectiveType) { | |||
case "3g": | |||
module = import(/* webpackChunkName: "light" */ "./Light.js"); | |||
case 'slow-2g': |
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 intentionally excluded the other supported values here as they were making the code-snippet look a little on the long side (I imagine most users would use 2 values) 😄
That said, perhaps a good middle ground is a line after each code-snippet that notes the supported return values? e.g 2g
, 3g
etc. Wdyt?
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 got you.
So for Network, Save Data, CPU Cores / Hardware Concurrency, Memory, after code snippet, we can add some line that notes the supported return values.
For example for Network, effectiveConnectionType values can be slow-2g, 2g, 3g, and 4g
.
Am I correct?
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.
switch (effectiveType) {
case '3g':
module = import(/* webpackChunkName: "light" */ './Light.js');
break;
case '4g':
module = import(/* webpackChunkName: "full" */ './Full.js');
break;
default:
module = import(/* webpackChunkName: "full" */ './Full.js');
break;
}
I thought that if effective connection type is 2g
, the user might end up downloading Full.js
.
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.
For example for Network, effectiveConnectionType values can be slow-2g, 2g, 3g, and 4g.
Yes, exactly!
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.
LGTM with minor comments.
@anton-karlovskiy This should be good to land soon. Would you like to go ahead with making those minor changes discussed in the comments? |
0c915e9
to
474fd36
Compare
Yes, it's done. Could you please review it? |
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.
LGTM
README is updated (minor).