You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* cleaned up README
* updated README for returning values for each hook or utility
* updated deployed URL in README for cna-memory-considerate-animation
* [docs] Minor formatting improvements
and then use them in your components. Examples for each hook and utility can be found below:
@@ -68,6 +67,8 @@ const MyComponent = () => {
68
67
};
69
68
```
70
69
70
+
`effectiveConnectionType` values can be `slow-2g`, `2g`, `3g`, or `4g`.
71
+
71
72
This hook accepts an optional `initialEffectiveConnectionType` string argument, which can be used to provide a `effectiveConnectionType` state value when the user's browser does not support the relevant [NetworkInformation API](https://wicg.github.io/netinfo/). Passing an initial value can also prove useful for server-side rendering, where the developer can pass an [ECT Client Hint](https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/client-hints#ect) to detect the effective network connection type.
72
73
73
74
```js
@@ -95,6 +96,8 @@ const MyComponent = () => {
95
96
};
96
97
```
97
98
99
+
`saveData` values can be `true` or `false`.
100
+
98
101
This hook accepts an optional `initialSaveDataStatus` boolean argument, which can be used to provide a `saveData` state value when the user's browser does not support the relevant [NetworkInformation API](https://wicg.github.io/netinfo/). Passing an initial value can also prove useful for server-side rendering, where the developer can pass a server [Save-Data Client Hint](https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/client-hints#save-data) that has been converted to a boolean to detect the user's data saving preference.
99
102
100
103
```js
@@ -122,6 +125,8 @@ const MyComponent = () => {
122
125
};
123
126
```
124
127
128
+
`numberOfLogicalProcessors` values can be the number of logical processors available to run threads on the user's device.
129
+
125
130
### Memory
126
131
127
132
`useMemoryStatus` utility for adapting based on the user's device memory (RAM)
@@ -141,6 +146,8 @@ const MyComponent = () => {
141
146
};
142
147
```
143
148
149
+
`deviceMemory` values can be the approximate amount of device memory in gigabytes.
150
+
144
151
This hook accepts an optional `initialMemoryStatus` object argument, which can be used to provide a `deviceMemory` state value when the user's browser does not support the relevant [DeviceMemory API](https://github.com/w3c/device-memory). Passing an initial value can also prove useful for server-side rendering, where the developer can pass a server [Device-Memory Client Hint](https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/client-hints#save-data) to detect the memory capacity of the user's device.
145
152
146
153
```js
@@ -163,7 +170,7 @@ import { useNetworkStatus } from 'react-adaptive-hooks/network';
*[Memory considerate loading](https://github.com/GoogleChromeLabs/adaptive-loading/tree/master/cra-memory-considerate-loading) with create-react-app ([Live](https://adaptive-loading.web.app/cra-memory-considerate-loading/))
282
287
*[Memory considerate loading (SketchFab version)](https://github.com/GoogleChromeLabs/adaptive-loading/tree/master/cra-memory-considerate-loading-sketchfab) with create-react-app ([Live](https://adaptive-loading.web.app/cra-memory-considerate-loading-sketchfab/))
283
-
*[Memory-considerate animation-toggling](https://github.com/GoogleChromeLabs/adaptive-loading/tree/master/cna-memory-considerate-animation) with create-next-app ([Live](https://cna-memory-animation.firebaseapp.com/))
288
+
*[Memory-considerate animation-toggling](https://github.com/GoogleChromeLabs/adaptive-loading/tree/master/cna-memory-considerate-animation) with create-next-app ([Live](https://adaptive-loading.web.app/cna-memory-considerate-animation/))
0 commit comments