dev-classes 1.3.11 → 1.3.13

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,8 @@
1
+ import { WatcherCB } from './types/types.abscruct';
2
+
1
3
  export declare class InternetWatchers {
2
4
  private state;
3
5
  private resetState;
4
- addWatchers(cb: (status: boolean) => void): void;
6
+ addWatchers(cb: WatcherCB): void;
5
7
  removeWatchers(): void;
6
8
  }
@@ -1,12 +1,12 @@
1
- var h = Object.defineProperty;
2
- var c = (e, t, s) => t in e ? h(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
3
- var i = (e, t, s) => (c(e, typeof t != "symbol" ? t + "" : t, s), s);
1
+ var c = Object.defineProperty;
2
+ var u = (e, t, s) => t in e ? c(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
3
+ var i = (e, t, s) => (u(e, typeof t != "symbol" ? t + "" : t, s), s);
4
4
  const l = {
5
5
  isNetworkStatus: window.navigator.onLine,
6
6
  listCloseSignals: [],
7
7
  isWatcher: !1
8
8
  };
9
- class g {
9
+ class f {
10
10
  constructor() {
11
11
  i(this, "state", l);
12
12
  i(this, "resetState", () => this.state = l);
@@ -15,12 +15,12 @@ class g {
15
15
  if (!this.state.isWatcher) {
16
16
  this.state.isWatcher = !0;
17
17
  const s = [
18
- { event: "online", status: !0 },
19
- { event: "offline", status: !1 }
18
+ { event: "online", status: !0, textStatus: "network" },
19
+ { event: "offline", status: !1, textStatus: "none" }
20
20
  ];
21
21
  for (let a = 0; a < s.length; a++) {
22
- const n = new AbortController(), { event: o, status: r } = s[a];
23
- this.state.listCloseSignals.push(n), window.addEventListener(o, () => t(r), { signal: n.signal });
22
+ const n = new AbortController(), { event: o, status: r, textStatus: h } = s[a];
23
+ this.state.listCloseSignals.push(n), window.addEventListener(o, () => t(r, h), { signal: n.signal });
24
24
  }
25
25
  }
26
26
  }
@@ -35,5 +35,5 @@ class g {
35
35
  }
36
36
  }
37
37
  export {
38
- g as InternetWatchers
38
+ f as InternetWatchers
39
39
  };
@@ -1,19 +1,19 @@
1
1
  var s = Object.defineProperty;
2
- var h = (t, o, r) => o in t ? s(t, o, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[o] = r;
3
- var n = (t, o, r) => (h(t, typeof o != "symbol" ? o + "" : o, r), r);
2
+ var h = (e, o, r) => o in e ? s(e, o, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[o] = r;
3
+ var t = (e, o, r) => (h(e, typeof o != "symbol" ? o + "" : o, r), r);
4
4
  import { NetworkInformationAbstract as i } from "./types/types.abscruct.js";
5
5
  class d extends i {
6
6
  constructor() {
7
7
  super(...arguments);
8
- n(this, "watchers", (r) => {
9
- const c = (e) => {
10
- console.error(e);
11
- }, a = (e) => {
12
- r(!(e === "unknown" || e === "none"));
8
+ t(this, "watchers", (r) => {
9
+ const c = (n) => {
10
+ console.error(n);
11
+ }, a = (n) => {
12
+ r(!(n === "unknown" || n === "none"), n);
13
13
  };
14
14
  navigator == null || navigator.connection.getInfo(a, c);
15
15
  });
16
- n(this, "getControls", () => ({
16
+ t(this, "getControls", () => ({
17
17
  system: "cordova",
18
18
  addWatchers: this.watchers,
19
19
  removeWatchers: () => {
@@ -1,14 +1,14 @@
1
- var s = Object.defineProperty;
2
- var a = (r, e, t) => e in r ? s(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var o = (r, e, t) => (a(r, typeof e != "symbol" ? e + "" : e, t), t);
4
- import { InternetWatchers as n } from "./InternetWatchers.js";
1
+ var n = Object.defineProperty;
2
+ var s = (r, e, t) => e in r ? n(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var o = (r, e, t) => (s(r, typeof e != "symbol" ? e + "" : e, t), t);
4
+ import { InternetWatchers as a } from "./InternetWatchers.js";
5
5
  import { NetworkInformationAbstract as h } from "./types/types.abscruct.js";
6
- class w extends h {
6
+ class c extends h {
7
7
  constructor() {
8
8
  super(...arguments);
9
- o(this, "network", new n());
9
+ o(this, "network", new a());
10
10
  o(this, "watchers", (t) => {
11
- navigator.onLine ? t(!0) : t(!1), this.network.addWatchers(t);
11
+ navigator.onLine ? t(!0, "network") : t(!1, "none"), this.network.addWatchers(t);
12
12
  });
13
13
  o(this, "getControls", () => ({
14
14
  system: "pc",
@@ -18,5 +18,5 @@ class w extends h {
18
18
  }
19
19
  }
20
20
  export {
21
- w as NetworkInformationPC
21
+ c as NetworkInformationPC
22
22
  };
@@ -1,5 +1,5 @@
1
1
  export type SystemType = 'pc' | 'cordova';
2
- export type WatcherCB = (status: boolean) => void;
2
+ export type WatcherCB = (status: boolean, textStatus: string) => void;
3
3
  export declare abstract class NetworkInformationAbstract {
4
4
  protected abstract watchers(cb: WatcherCB): void;
5
5
  abstract getControls(): {
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "homepage": "https://github.com/SinGlEBW/dev-classes#readme",
13
13
  "license": "MIT",
14
- "version": "1.3.11",
14
+ "version": "1.3.13",
15
15
  "type": "module",
16
16
  "module": "./dist/index.js",
17
17
  "main": "./dist/index.js",