dev-classes 1.5.2 → 1.5.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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { NetworkStatusInfoTracker, NetworkStatusConfig, OnStatusChange, NetworkConstructorConfig } from './NetworkStatusTracker.types';
|
|
2
2
|
export declare class NetworkStatusTracker {
|
|
3
3
|
private networkInfo;
|
|
4
|
+
private configInit?;
|
|
4
5
|
private listUrls;
|
|
5
6
|
private state;
|
|
6
7
|
private setState;
|
package/dist/index.js
CHANGED
|
@@ -2618,6 +2618,7 @@ c(Numbers, "getOnlyTheStringNumbers", (e) => e.split("").filter((t) => !Number.i
|
|
|
2618
2618
|
class NetworkStatusTracker {
|
|
2619
2619
|
constructor(e = []) {
|
|
2620
2620
|
c(this, "networkInfo");
|
|
2621
|
+
c(this, "configInit");
|
|
2621
2622
|
c(this, "listUrls", []);
|
|
2622
2623
|
c(this, "state", {
|
|
2623
2624
|
isActiveEvents: !1,
|
|
@@ -2672,10 +2673,15 @@ class NetworkStatusTracker {
|
|
|
2672
2673
|
this.controllersEvents = { ...this.controllersEvents, ...e };
|
|
2673
2674
|
}
|
|
2674
2675
|
async initialize(e, t) {
|
|
2675
|
-
if (!this.state.isInitialized)
|
|
2676
|
+
if (this.configInit = t, !this.state.isInitialized)
|
|
2676
2677
|
try {
|
|
2677
|
-
|
|
2678
|
-
|
|
2678
|
+
if (this.listUrls.length > 0)
|
|
2679
|
+
await this.requestByUrls(e, t);
|
|
2680
|
+
else {
|
|
2681
|
+
const r = typeof navigator < "u" ? navigator.onLine : !1;
|
|
2682
|
+
this.updateState(r, e);
|
|
2683
|
+
}
|
|
2684
|
+
this.setState({ isInitialized: !0 });
|
|
2679
2685
|
} catch (r) {
|
|
2680
2686
|
console.error("NetworkStatusTracker initialization error:", r), this.updateState(!1, e), this.setState({ isInitialized: !0 });
|
|
2681
2687
|
}
|
|
@@ -2691,29 +2697,32 @@ class NetworkStatusTracker {
|
|
|
2691
2697
|
offline: new AbortController(),
|
|
2692
2698
|
change: new AbortController()
|
|
2693
2699
|
};
|
|
2694
|
-
this.setControllersEvents(i)
|
|
2695
|
-
const o = this.getConnection();
|
|
2696
|
-
o && (o != null && o.addEventListener) ? o.addEventListener(
|
|
2697
|
-
"change",
|
|
2698
|
-
(f) => {
|
|
2699
|
-
console.log("NetworkStatusTracker: connection change event");
|
|
2700
|
-
const m = navigator.onLine;
|
|
2701
|
-
this.updateState(m, e);
|
|
2702
|
-
},
|
|
2703
|
-
{ signal: (a = i.change) == null ? void 0 : a.signal }
|
|
2704
|
-
) : (window.addEventListener(
|
|
2700
|
+
this.setControllersEvents(i), window.addEventListener(
|
|
2705
2701
|
"online",
|
|
2706
2702
|
() => {
|
|
2707
2703
|
this.updateState(!0, e);
|
|
2708
2704
|
},
|
|
2709
|
-
{ signal: (
|
|
2705
|
+
{ signal: (a = i.online) == null ? void 0 : a.signal }
|
|
2710
2706
|
), window.addEventListener(
|
|
2711
2707
|
"offline",
|
|
2712
2708
|
() => {
|
|
2713
2709
|
this.updateState(!1, e);
|
|
2714
2710
|
},
|
|
2715
|
-
{ signal: (
|
|
2716
|
-
)
|
|
2711
|
+
{ signal: (u = i.offline) == null ? void 0 : u.signal }
|
|
2712
|
+
);
|
|
2713
|
+
const o = this.getConnection();
|
|
2714
|
+
o && (o != null && o.addEventListener) && o.addEventListener(
|
|
2715
|
+
"change",
|
|
2716
|
+
async (f) => {
|
|
2717
|
+
if (this.listUrls.length > 0)
|
|
2718
|
+
await this.requestByUrls(e, this.configInit);
|
|
2719
|
+
else {
|
|
2720
|
+
const m = navigator.onLine;
|
|
2721
|
+
this.updateState(m, e);
|
|
2722
|
+
}
|
|
2723
|
+
},
|
|
2724
|
+
{ signal: (l = i.change) == null ? void 0 : l.signal }
|
|
2725
|
+
), t();
|
|
2717
2726
|
});
|
|
2718
2727
|
});
|
|
2719
2728
|
}
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"url": "git+https://github.com/SinGlEBW/dev-classes.git"
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
14
|
-
"version": "1.5.
|
|
14
|
+
"version": "1.5.4",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"module": "./dist/index.js",
|
|
17
17
|
"main": "./dist/index.js",
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"scripts": {
|
|
45
45
|
"dev": "vite",
|
|
46
46
|
"build": "tsc && vite build",
|
|
47
|
+
"build:dev": "node buildEditVersion.js",
|
|
47
48
|
"preview": "vite preview",
|
|
48
49
|
"send": "node publishVersion.js"
|
|
49
50
|
},
|