@sigx/lynx-network 0.4.2 → 0.4.4
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 +0 -17
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,48 +1,31 @@
|
|
|
1
1
|
# @sigx/lynx-network
|
|
2
|
-
|
|
3
2
|
Network connectivity status for sigx-lynx. `NWPathMonitor` on iOS, `ConnectivityManager` on Android.
|
|
4
|
-
|
|
5
3
|
## Install
|
|
6
|
-
|
|
7
4
|
```bash
|
|
8
5
|
pnpm add @sigx/lynx-network
|
|
9
6
|
```
|
|
10
|
-
|
|
11
7
|
`sigx prebuild` auto-discovers and links the native module. No special permissions on either platform.
|
|
12
|
-
|
|
13
8
|
## Usage
|
|
14
|
-
|
|
15
9
|
```ts
|
|
16
10
|
import { Network } from '@sigx/lynx-network';
|
|
17
|
-
|
|
18
11
|
const state = await Network.getState();
|
|
19
12
|
if (state.isConnected && state.type === 'wifi') {
|
|
20
13
|
// sync large payload
|
|
21
14
|
}
|
|
22
15
|
```
|
|
23
|
-
|
|
24
16
|
## API
|
|
25
|
-
|
|
26
17
|
| Method | Notes |
|
|
27
18
|
| ------------------------------------- | -------------------------------------------------------------------------------------------------- |
|
|
28
19
|
| `getState(): Promise<NetworkState>` | Single async snapshot — no subscription stream yet. |
|
|
29
20
|
| `isAvailable(): boolean` | Whether the native module is registered in the current build. |
|
|
30
|
-
|
|
31
21
|
```ts
|
|
32
22
|
type ConnectionType = 'wifi' | 'cellular' | 'ethernet' | 'bluetooth' | 'none' | 'unknown';
|
|
33
|
-
|
|
34
23
|
interface NetworkState {
|
|
35
24
|
isConnected: boolean;
|
|
36
25
|
type: ConnectionType;
|
|
37
26
|
isInternetReachable: boolean | null; // null = unknown (e.g. captive portal)
|
|
38
27
|
}
|
|
39
28
|
```
|
|
40
|
-
|
|
41
29
|
## Gotchas
|
|
42
|
-
|
|
43
30
|
- **`isInternetReachable: null`** means the OS hasn't confirmed actual reachability — common on captive-portal Wi-Fi (you're connected to an AP but can't reach the internet without sign-in). Treat as "probably yes".
|
|
44
31
|
- **No subscription API yet.** If you need to react to connectivity changes live, poll `getState()` from a `setInterval` or wrap a small effect — the native publisher exists but isn't surfaced as JS events in this version.
|
|
45
|
-
|
|
46
|
-
## Reference app
|
|
47
|
-
|
|
48
|
-
`examples/lynx-one/my-sigx-app/src/cards/NetworkCard.tsx` renders the snapshot and refreshes on tap.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sigx/lynx-network",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"description": "Network connectivity status for sigx-lynx",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"signalx-module.json"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@sigx/lynx-core": "^0.4.
|
|
22
|
+
"@sigx/lynx-core": "^0.4.4"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@typescript/native-preview": "7.0.0-dev.20260521.1",
|