Skip to content
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

[hooks] Memory hook feedback #69

Closed
addyosmani opened this issue Oct 24, 2019 · 2 comments
Closed

[hooks] Memory hook feedback #69

addyosmani opened this issue Oct 24, 2019 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@addyosmani
Copy link
Collaborator

Our React Hooks currently return a number of different kinds of values:

  • Network returns a string of 2g/3g/4g etc.
  • Hardware concurrency returns an integer for the number of cores
  • Memory returns a boolean of whether you are overloaded
  • Battery returns a float value . (e.g 0.75)
  • Device class returns a string for light/heavy

Of these values, memory stands out as a hook where we (project authors) are making a decision about what is overloaded. For all the other hooks, we just give developers the value and let them make a decision themselves.

For consistency, we should rewrite the memory hook to just provide a value from navigator.deviceMemory and optionally provide access to performance memory data, but assume the deviceMemory value is the main thing developers are after here.

cc @anton-karlovskiy

@addyosmani addyosmani added the help wanted Extra attention is needed label Oct 24, 2019
@anton-karlovskiy
Copy link
Contributor

anton-karlovskiy commented Oct 24, 2019

@addyosmani
It makes sense.

  1. updating memory hook with its Unit Test -- done
  2. updating memory demo projects -- done
  3. updating hooks/README -- done
  4. local testing -- done
  5. deployment again -- done
  6. online testing -- done

@addyosmani
Copy link
Collaborator Author

That would be great. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants