@capacitor/network 7.0.1 → 7.0.2-dev-2372-20250604T143221.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/dist/plugin.cjs.js +3 -4
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +3 -4
- package/dist/plugin.js.map +1 -1
- package/package.json +5 -6
package/dist/plugin.cjs.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var core = require('@capacitor/core');
|
|
4
4
|
|
|
5
|
-
const Network
|
|
5
|
+
const Network = core.registerPlugin('Network', {
|
|
6
6
|
web: () => Promise.resolve().then(function () { return web; }).then(m => new m.NetworkWeb()),
|
|
7
7
|
});
|
|
8
8
|
|
|
@@ -80,13 +80,12 @@ class NetworkWeb extends core.WebPlugin {
|
|
|
80
80
|
return status;
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
|
|
83
|
+
new NetworkWeb();
|
|
84
84
|
|
|
85
85
|
var web = /*#__PURE__*/Object.freeze({
|
|
86
86
|
__proto__: null,
|
|
87
|
-
Network: Network,
|
|
88
87
|
NetworkWeb: NetworkWeb
|
|
89
88
|
});
|
|
90
89
|
|
|
91
|
-
exports.Network = Network
|
|
90
|
+
exports.Network = Network;
|
|
92
91
|
//# sourceMappingURL=plugin.cjs.js.map
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Network = registerPlugin('Network', {\n web: () => import('./web').then(m => new m.NetworkWeb()),\n});\nexport * from './definitions';\nexport { Network };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nfunction translatedConnection() {\n const connection = window.navigator.connection ||\n window.navigator.mozConnection ||\n window.navigator.webkitConnection;\n let result = '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}\nexport class NetworkWeb extends WebPlugin {\n constructor() {\n super();\n this.handleOnline = () => {\n const connectionType = translatedConnection();\n const status = {\n connected: true,\n connectionType: connectionType,\n };\n this.notifyListeners('networkStatusChange', status);\n };\n this.handleOffline = () => {\n const status = {\n connected: false,\n connectionType: 'none',\n };\n this.notifyListeners('networkStatusChange', status);\n };\n if (typeof window !== 'undefined') {\n window.addEventListener('online', this.handleOnline);\n window.addEventListener('offline', this.handleOffline);\n }\n }\n async getStatus() {\n if (!window.navigator) {\n throw this.unavailable('Browser does not support the Network Information API');\n }\n const connected = window.navigator.onLine;\n const connectionType = translatedConnection();\n const status = {\n connected,\n connectionType: connected ? connectionType : 'none',\n };\n return status;\n }\n}\nconst Network = new NetworkWeb();\nexport { Network };\n//# sourceMappingURL=web.js.map"],"names":["
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Network = registerPlugin('Network', {\n web: () => import('./web').then(m => new m.NetworkWeb()),\n});\nexport * from './definitions';\nexport { Network };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nfunction translatedConnection() {\n const connection = window.navigator.connection ||\n window.navigator.mozConnection ||\n window.navigator.webkitConnection;\n let result = '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}\nexport class NetworkWeb extends WebPlugin {\n constructor() {\n super();\n this.handleOnline = () => {\n const connectionType = translatedConnection();\n const status = {\n connected: true,\n connectionType: connectionType,\n };\n this.notifyListeners('networkStatusChange', status);\n };\n this.handleOffline = () => {\n const status = {\n connected: false,\n connectionType: 'none',\n };\n this.notifyListeners('networkStatusChange', status);\n };\n if (typeof window !== 'undefined') {\n window.addEventListener('online', this.handleOnline);\n window.addEventListener('offline', this.handleOffline);\n }\n }\n async getStatus() {\n if (!window.navigator) {\n throw this.unavailable('Browser does not support the Network Information API');\n }\n const connected = window.navigator.onLine;\n const connectionType = translatedConnection();\n const status = {\n connected,\n connectionType: connected ? connectionType : 'none',\n };\n return status;\n }\n}\nconst Network = new NetworkWeb();\nexport { Network };\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,OAAO,GAAGA,mBAAc,CAAC,SAAS,EAAE;AAC1C,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC;AAC5D,CAAC;;ACFD,SAAS,oBAAoB,GAAG;AAChC,IAAI,MAAM,UAAU,GAAG,MAAM,CAAC,SAAS,CAAC,UAAU;AAClD,QAAQ,MAAM,CAAC,SAAS,CAAC,aAAa;AACtC,QAAQ,MAAM,CAAC,SAAS,CAAC,gBAAgB;AACzC,IAAI,IAAI,MAAM,GAAG,SAAS;AAC1B,IAAI,MAAM,IAAI,GAAG,UAAU,GAAG,UAAU,CAAC,IAAI,IAAI,UAAU,CAAC,aAAa,GAAG,IAAI;AAChF,IAAI,IAAI,IAAI,IAAI,OAAO,I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,EAAE,MAAM,CAAC;AAC/D,SAAS;AACT,QAAQ,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;AAC3C,YAAY,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,YAAY,CAAC;AAChE,YAAY,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC;AAClE;AACA;AACA,IAAI,MAAM,SAAS,GAAG;AACtB,QAAQ,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;AAC/B,YAAY,MAAM,IAAI,CAAC,WAAW,CAAC,sDAAsD,CAAC;AAC1F;AACA,QAAQ,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM;AACjD,QAAQ,MAAM,cAAc,GAAG,oBAAoB,EAAE;AACrD,QAAQ,MAAM,MAAM,GAAG;AACvB,YAAY,SAAS;AACrB,YAAY,cAAc,EAAE,SAAS,GAAG,cAAc,GAAG,MAAM;AAC/D,SAAS;AACT,QAAQ,OAAO,MAAM;AACrB;AACA;AACgB,IAAI,UAAU;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var capacitorNetwork = (function (exports, core) {
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
const Network
|
|
4
|
+
const Network = core.registerPlugin('Network', {
|
|
5
5
|
web: () => Promise.resolve().then(function () { return web; }).then(m => new m.NetworkWeb()),
|
|
6
6
|
});
|
|
7
7
|
|
|
@@ -79,15 +79,14 @@ var capacitorNetwork = (function (exports, core) {
|
|
|
79
79
|
return status;
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
|
|
82
|
+
new NetworkWeb();
|
|
83
83
|
|
|
84
84
|
var web = /*#__PURE__*/Object.freeze({
|
|
85
85
|
__proto__: null,
|
|
86
|
-
Network: Network,
|
|
87
86
|
NetworkWeb: NetworkWeb
|
|
88
87
|
});
|
|
89
88
|
|
|
90
|
-
exports.Network = Network
|
|
89
|
+
exports.Network = Network;
|
|
91
90
|
|
|
92
91
|
return exports;
|
|
93
92
|
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Network = registerPlugin('Network', {\n web: () => import('./web').then(m => new m.NetworkWeb()),\n});\nexport * from './definitions';\nexport { Network };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nfunction translatedConnection() {\n const connection = window.navigator.connection ||\n window.navigator.mozConnection ||\n window.navigator.webkitConnection;\n let result = '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}\nexport class NetworkWeb extends WebPlugin {\n constructor() {\n super();\n this.handleOnline = () => {\n const connectionType = translatedConnection();\n const status = {\n connected: true,\n connectionType: connectionType,\n };\n this.notifyListeners('networkStatusChange', status);\n };\n this.handleOffline = () => {\n const status = {\n connected: false,\n connectionType: 'none',\n };\n this.notifyListeners('networkStatusChange', status);\n };\n if (typeof window !== 'undefined') {\n window.addEventListener('online', this.handleOnline);\n window.addEventListener('offline', this.handleOffline);\n }\n }\n async getStatus() {\n if (!window.navigator) {\n throw this.unavailable('Browser does not support the Network Information API');\n }\n const connected = window.navigator.onLine;\n const connectionType = translatedConnection();\n const status = {\n connected,\n connectionType: connected ? connectionType : 'none',\n };\n return status;\n }\n}\nconst Network = new NetworkWeb();\nexport { Network };\n//# sourceMappingURL=web.js.map"],"names":["
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Network = registerPlugin('Network', {\n web: () => import('./web').then(m => new m.NetworkWeb()),\n});\nexport * from './definitions';\nexport { Network };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nfunction translatedConnection() {\n const connection = window.navigator.connection ||\n window.navigator.mozConnection ||\n window.navigator.webkitConnection;\n let result = '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}\nexport class NetworkWeb extends WebPlugin {\n constructor() {\n super();\n this.handleOnline = () => {\n const connectionType = translatedConnection();\n const status = {\n connected: true,\n connectionType: connectionType,\n };\n this.notifyListeners('networkStatusChange', status);\n };\n this.handleOffline = () => {\n const status = {\n connected: false,\n connectionType: 'none',\n };\n this.notifyListeners('networkStatusChange', status);\n };\n if (typeof window !== 'undefined') {\n window.addEventListener('online', this.handleOnline);\n window.addEventListener('offline', this.handleOffline);\n }\n }\n async getStatus() {\n if (!window.navigator) {\n throw this.unavailable('Browser does not support the Network Information API');\n }\n const connected = window.navigator.onLine;\n const connectionType = translatedConnection();\n const status = {\n connected,\n connectionType: connected ? connectionType : 'none',\n };\n return status;\n }\n}\nconst Network = new NetworkWeb();\nexport { Network };\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,OAAO,GAAGA,mBAAc,CAAC,SAAS,EAAE;IAC1C,IAAI,GAAG,EAAE,MAAM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
+
"version": "7.0.2-dev-2372-20250604T143221.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",
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
"publish:cocoapod": "pod trunk push ./CapacitorNetwork.podspec --allow-warnings"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@capacitor/android": "
|
|
51
|
-
"@capacitor/core": "
|
|
50
|
+
"@capacitor/android": "^7.0.0",
|
|
51
|
+
"@capacitor/core": "^7.0.0",
|
|
52
52
|
"@capacitor/docgen": "0.2.2",
|
|
53
|
-
"@capacitor/ios": "
|
|
53
|
+
"@capacitor/ios": "^7.0.0",
|
|
54
54
|
"@ionic/eslint-config": "^0.4.0",
|
|
55
55
|
"@ionic/prettier-config": "~1.0.1",
|
|
56
56
|
"@ionic/swiftlint-config": "^1.1.2",
|
|
@@ -80,6 +80,5 @@
|
|
|
80
80
|
},
|
|
81
81
|
"publishConfig": {
|
|
82
82
|
"access": "public"
|
|
83
|
-
}
|
|
84
|
-
"gitHead": "927f549a995118acd8e5735835300c4c3cbf3de7"
|
|
83
|
+
}
|
|
85
84
|
}
|