use-online-checking 1.0.4 → 1.0.6
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 +26 -17
- package/package.json +13 -4
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# use-online-checking
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A lightweight React hook to detect internet connection status (online/offline) in real-time.
|
|
4
|
+
|
|
5
|
+
This hook helps React developers easily track browser network status changes.
|
|
4
6
|
|
|
5
7
|
---
|
|
6
8
|
|
|
@@ -10,21 +12,22 @@ A simple and lightweight custom React hook to detect browser online and offline
|
|
|
10
12
|
- ⚡ Real-time network status detection
|
|
11
13
|
- 🔄 Automatic event listener cleanup
|
|
12
14
|
- 🧠 Easy to use in any React project
|
|
15
|
+
- ✅ TypeScript support included
|
|
13
16
|
|
|
14
17
|
---
|
|
15
18
|
|
|
16
19
|
## 📦 Installation
|
|
17
20
|
|
|
18
|
-
If published to npm:
|
|
19
|
-
|
|
20
21
|
```bash
|
|
21
22
|
npm install use-online-checking
|
|
22
23
|
```
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
---
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
## 📥 Import
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
import useOnline from "use-online-checking";
|
|
28
31
|
```
|
|
29
32
|
|
|
30
33
|
---
|
|
@@ -66,33 +69,39 @@ When the network status changes, the state updates automatically.
|
|
|
66
69
|
|
|
67
70
|
## 📌 API
|
|
68
71
|
|
|
69
|
-
### `useOnline()`
|
|
72
|
+
### `useOnline(): boolean`
|
|
70
73
|
|
|
71
74
|
Returns:
|
|
72
75
|
|
|
73
|
-
| Name
|
|
74
|
-
|
|
75
|
-
| isOnline
|
|
76
|
+
| Name | Type | Description |
|
|
77
|
+
|----------|---------|--------------------------------------|
|
|
78
|
+
| isOnline | boolean | Current internet connection status |
|
|
76
79
|
|
|
77
80
|
---
|
|
78
81
|
|
|
79
|
-
## 📁
|
|
82
|
+
## 📁 Package Structure
|
|
80
83
|
|
|
81
84
|
```
|
|
82
|
-
use-online/
|
|
85
|
+
use-online-checking/
|
|
83
86
|
│
|
|
84
87
|
├── src/
|
|
85
|
-
│
|
|
86
|
-
│ ├── App.jsx
|
|
87
|
-
│ ├── main.jsx
|
|
88
|
+
│ └── useOnline.js
|
|
88
89
|
│
|
|
90
|
+
├── index.js
|
|
91
|
+
├── index.d.ts
|
|
89
92
|
├── package.json
|
|
90
93
|
├── README.md
|
|
91
|
-
└──
|
|
94
|
+
└── LICENSE
|
|
92
95
|
```
|
|
93
96
|
|
|
94
97
|
---
|
|
95
98
|
|
|
99
|
+
## 🛠 Requirements
|
|
100
|
+
|
|
101
|
+
- React 16.8 or higher (Hooks support)
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
96
105
|
## 🤝 Contributing
|
|
97
106
|
|
|
98
107
|
Contributions are welcome.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "use-online-checking",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Lightweight React hook to detect online/offline network status in real time.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -12,9 +12,18 @@
|
|
|
12
12
|
"react",
|
|
13
13
|
"react-hook",
|
|
14
14
|
"custom-hook",
|
|
15
|
-
"
|
|
16
|
-
"online",
|
|
17
|
-
"offline"
|
|
15
|
+
"useOnline",
|
|
16
|
+
"online-status",
|
|
17
|
+
"offline-detection",
|
|
18
|
+
"internet-connection",
|
|
19
|
+
"network-status",
|
|
20
|
+
"react-online-hook",
|
|
21
|
+
"isOnline",
|
|
22
|
+
"isOffline",
|
|
23
|
+
"checkOffline",
|
|
24
|
+
"checkOnline",
|
|
25
|
+
"checkUserOnline",
|
|
26
|
+
"checkUserOffline"
|
|
18
27
|
],
|
|
19
28
|
"peerDependencies": {
|
|
20
29
|
"react": ">=16.8"
|