dev-classes 1.5.2 → 1.5.3

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
- const r = typeof navigator < "u" ? navigator.onLine : !1;
2678
- this.listUrls.length > 0 ? await this.requestByUrls(e, t) : this.updateState(r, e), this.setState({ isInitialized: !0 });
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
  }
@@ -2695,10 +2701,13 @@ class NetworkStatusTracker {
2695
2701
  const o = this.getConnection();
2696
2702
  o && (o != null && o.addEventListener) ? o.addEventListener(
2697
2703
  "change",
2698
- (f) => {
2699
- console.log("NetworkStatusTracker: connection change event");
2700
- const m = navigator.onLine;
2701
- this.updateState(m, e);
2704
+ async (f) => {
2705
+ if (this.listUrls.length > 0)
2706
+ await this.requestByUrls(e, this.configInit);
2707
+ else {
2708
+ const m = navigator.onLine;
2709
+ this.updateState(m, e);
2710
+ }
2702
2711
  },
2703
2712
  { signal: (a = i.change) == null ? void 0 : a.signal }
2704
2713
  ) : (window.addEventListener(
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.2",
14
+ "version": "1.5.3",
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
  },