@auraqule/react-network-status 0.2.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -10
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -6,6 +6,12 @@
|
|
|
6
6
|
[](https://bundlephobia.com/package/react-network-status)
|
|
7
7
|
[](./LICENSE)
|
|
8
8
|
|
|
9
|
+
## Live Demo
|
|
10
|
+
|
|
11
|
+
🎯 **Try it yourself:** [https://react-packages-demo.vercel.app/](https://react-packages-demo.vercel.app/)
|
|
12
|
+
|
|
13
|
+
Toggle your network connection or enable browser throttling to see the hook respond in real time.
|
|
14
|
+
|
|
9
15
|
## Install
|
|
10
16
|
|
|
11
17
|
```bash
|
|
@@ -53,16 +59,16 @@ No options — just call it.
|
|
|
53
59
|
|
|
54
60
|
### Returns
|
|
55
61
|
|
|
56
|
-
| Value
|
|
57
|
-
|
|
58
|
-
| `isOnline`
|
|
59
|
-
| `isOffline`
|
|
60
|
-
| `connectionType` | `ConnectionType`
|
|
61
|
-
| `effectiveType`
|
|
62
|
-
| `downlink`
|
|
63
|
-
| `rtt`
|
|
64
|
-
| `saveData`
|
|
65
|
-
| `refresh`
|
|
62
|
+
| Value | Type | Description |
|
|
63
|
+
| ---------------- | ------------------------- | ------------------------------------------------- |
|
|
64
|
+
| `isOnline` | `boolean` | Whether the browser has network access |
|
|
65
|
+
| `isOffline` | `boolean` | Inverse of `isOnline` |
|
|
66
|
+
| `connectionType` | `ConnectionType` | wifi, ethernet, cellular, 2g, 3g, 4g, 5g, unknown |
|
|
67
|
+
| `effectiveType` | `EffectiveConnectionType` | slow-2g, 2g, 3g, 4g, unknown |
|
|
68
|
+
| `downlink` | `number \| undefined` | Estimated bandwidth in Mbps |
|
|
69
|
+
| `rtt` | `number \| undefined` | Estimated round-trip time in ms |
|
|
70
|
+
| `saveData` | `boolean \| undefined` | Whether data saver is enabled |
|
|
71
|
+
| `refresh` | `() => void` | Manually re-read network status |
|
|
66
72
|
|
|
67
73
|
> `connectionType`, `effectiveType`, `downlink`, `rtt`, and `saveData` rely on the [Network Information API](https://developer.mozilla.org/en-US/docs/Web/API/Network_Information_API), which is not supported in all browsers. They will return `undefined` or `"unknown"` when unavailable.
|
|
68
74
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@auraqule/react-network-status",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "A React hook to monitor network connectivity, online/offline state, and connection type",
|
|
5
|
+
"homepage": "https://react-packages-demo.vercel.app/",
|
|
5
6
|
"keywords": [
|
|
6
7
|
"react",
|
|
7
8
|
"hook",
|
|
@@ -16,7 +17,10 @@
|
|
|
16
17
|
"repository": {
|
|
17
18
|
"type": "git",
|
|
18
19
|
"url": "https://github.com/auraqule/react-utils-monorepo.git",
|
|
19
|
-
"directory": "packages/react-
|
|
20
|
+
"directory": "packages/react-network-status"
|
|
21
|
+
},
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/auraqule/react-utils-monorepo/issues"
|
|
20
24
|
},
|
|
21
25
|
"main": "./dist/index.js",
|
|
22
26
|
"module": "./dist/index.mjs",
|