@capacitor/network 8.0.0-dev-2434-20251110T164702.0 → 8.0.0-dev-2440-20251112T164407.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/Package.swift +1 -1
- package/dist/esm/definitions.d.ts +4 -4
- package/dist/esm/web.js.map +1 -1
- package/package.json +8 -8
package/Package.swift
CHANGED
|
@@ -10,7 +10,7 @@ let package = Package(
|
|
|
10
10
|
targets: ["CAPNetworkPlugin"])
|
|
11
11
|
],
|
|
12
12
|
dependencies: [
|
|
13
|
-
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "
|
|
13
|
+
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0")
|
|
14
14
|
],
|
|
15
15
|
targets: [
|
|
16
16
|
.target(
|
|
@@ -45,20 +45,20 @@ export interface ConnectionStatus {
|
|
|
45
45
|
*
|
|
46
46
|
* @since 1.0.0
|
|
47
47
|
*/
|
|
48
|
-
export
|
|
48
|
+
export type ConnectionStatusChangeListener = (status: ConnectionStatus) => void;
|
|
49
49
|
/**
|
|
50
50
|
* The type of network connection that a device might have.
|
|
51
51
|
*
|
|
52
52
|
* @since 1.0.0
|
|
53
53
|
*/
|
|
54
|
-
export
|
|
54
|
+
export type ConnectionType = 'wifi' | 'cellular' | 'none' | 'unknown';
|
|
55
55
|
/**
|
|
56
56
|
* @deprecated Use `ConnectionStatus`.
|
|
57
57
|
* @since 1.0.0
|
|
58
58
|
*/
|
|
59
|
-
export
|
|
59
|
+
export type NetworkStatus = ConnectionStatus;
|
|
60
60
|
/**
|
|
61
61
|
* @deprecated Use `ConnectionStatusChangeListener`.
|
|
62
62
|
* @since 1.0.0
|
|
63
63
|
*/
|
|
64
|
-
export
|
|
64
|
+
export type NetworkStatusChangeCallback = ConnectionStatusChangeListener;
|
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources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AC;QAED,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC;QAC1C,MAAM,cAAc,GAAG,oBAAoB,EAAE,CAAC;QAE9C,MAAM,MAAM,GAAqB;YAC/B,SAAS;YACT,cAAc,EAAE,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM;SACpD,CAAC;QAEF,OAAO,MAAM,CAAC;IAChB,CAAC;CAqBF;AAED,MAAM,OAAO,GAAG,IAAI,UAAU,EAAE,CAAC;AAEjC,OAAO,EAAE,OAAO,EAAE,CAAC","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type {\n ConnectionStatus,\n ConnectionType,\n NetworkPlugin,\n} from './definitions';\n\ndeclare global {\n interface Navigator {\n connection: any;\n mozConnection: any;\n webkitConnection: any;\n }\n}\n\nfunction translatedConnection(): ConnectionType {\n const connection =\n window.navigator.connection ||\n window.navigator.mozConnection ||\n window.navigator.webkitConnection;\n let result: ConnectionType = 'unknown';\n const type = connection ? connection.type || connection.effectiveType : null;\n if (type && typeof type === 'string') {\n switch (type) {\n // possible type values\n case 'bluetooth':\n case 'cellular':\n result = 'cellular';\n break;\n case 'none':\n result = 'none';\n break;\n case 'ethernet':\n case 'wifi':\n case 'wimax':\n result = 'wifi';\n break;\n case 'other':\n case 'unknown':\n result = 'unknown';\n break;\n // possible effectiveType values\n case 'slow-2g':\n case '2g':\n case '3g':\n result = 'cellular';\n break;\n case '4g':\n result = 'wifi';\n break;\n default:\n break;\n }\n }\n return result;\n}\n\nexport class NetworkWeb extends WebPlugin implements NetworkPlugin {\n constructor() {\n super();\n if (typeof window !== 'undefined') {\n window.addEventListener('online', this.handleOnline);\n window.addEventListener('offline', this.handleOffline);\n }\n }\n\n async getStatus(): Promise<ConnectionStatus> {\n if (!window.navigator) {\n throw this.unavailable(\n 'Browser does not support the Network Information API',\n );\n }\n\n const connected = window.navigator.onLine;\n const connectionType = translatedConnection();\n\n const status: ConnectionStatus = {\n connected,\n connectionType: connected ? connectionType : 'none',\n };\n\n return status;\n }\n\n private handleOnline = () => {\n const connectionType = translatedConnection();\n\n const status: ConnectionStatus = {\n connected: true,\n connectionType: connectionType,\n };\n\n this.notifyListeners('networkStatusChange', status);\n };\n\n private handleOffline = () => {\n const status: ConnectionStatus = {\n connected: false,\n connectionType: 'none',\n };\n\n this.notifyListeners('networkStatusChange', status);\n };\n}\n\nconst Network = new NetworkWeb();\n\nexport { Network };\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor/network",
|
|
3
|
-
"version": "8.0.0-dev-
|
|
3
|
+
"version": "8.0.0-dev-2440-20251112T164407.0",
|
|
4
4
|
"description": "The Network API provides network and connectivity information.",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -49,18 +49,18 @@
|
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@capacitor/android": "next",
|
|
51
51
|
"@capacitor/core": "next",
|
|
52
|
-
"@capacitor/docgen": "0.
|
|
52
|
+
"@capacitor/docgen": "0.3.0",
|
|
53
53
|
"@capacitor/ios": "next",
|
|
54
54
|
"@ionic/eslint-config": "^0.4.0",
|
|
55
55
|
"@ionic/prettier-config": "~1.0.1",
|
|
56
|
-
"@ionic/swiftlint-config": "^
|
|
57
|
-
"eslint": "^8.57.
|
|
56
|
+
"@ionic/swiftlint-config": "^2.0.0",
|
|
57
|
+
"eslint": "^8.57.1",
|
|
58
58
|
"prettier": "~2.3.0",
|
|
59
59
|
"prettier-plugin-java": "~1.0.2",
|
|
60
|
-
"rimraf": "^6.0
|
|
61
|
-
"rollup": "^4.
|
|
62
|
-
"swiftlint": "^
|
|
63
|
-
"typescript": "
|
|
60
|
+
"rimraf": "^6.1.0",
|
|
61
|
+
"rollup": "^4.53.2",
|
|
62
|
+
"swiftlint": "^2.0.0",
|
|
63
|
+
"typescript": "^5.9.3"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"@capacitor/core": "next"
|