dev-classes 1.3.28 → 1.3.30

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,15 @@
1
+ import { WsApi_Events } from './deps/WsApi/WsApi.types';
1
2
  import { WsApi_Options_P } from './deps/WsApi';
2
3
  import { SocketApi_Options_P, SocketApi_StateProps_P } from './SocketApi.types';
3
4
 
5
+ interface SocketApi_Events {
6
+ timeOffReConnect(info: {
7
+ status: boolean;
8
+ msg: string;
9
+ }): void;
10
+ reConnect(status: boolean): void;
11
+ }
12
+ type CommonEvents = SocketApi_Events & WsApi_Events;
4
13
  export declare class SocketApi {
5
14
  #private;
6
15
  private static state;
@@ -21,8 +30,16 @@ export declare class SocketApi {
21
30
  private static offline;
22
31
  private static splitOptions;
23
32
  static getState: () => SocketApi_StateProps_P;
24
- static on: typeof SocketApi.wsApi.on & typeof SocketApi.events.subscribe;
33
+ static on: <K extends keyof CommonEvents>(name: K, cb: CommonEvents[K]) => void;
25
34
  static off: typeof SocketApi.wsApi.on & typeof SocketApi.events.subscribe;
35
+ static getRequestSave: () => {
36
+ payload: {
37
+ [key: string]: any;
38
+ action: string;
39
+ };
40
+ reqId: string;
41
+ cb: any;
42
+ }[];
26
43
  static getStatusSocket: () => import('./deps/WsApi').WsApiE_StatusConnect_OR;
27
44
  static close: () => void;
28
45
  static init: (options: WsApi_Options_P & SocketApi_Options_P) => void;
@@ -32,3 +49,4 @@ export declare class SocketApi {
32
49
  static stopReConnect(status?: boolean): void;
33
50
  static socketReConnect: () => void;
34
51
  }
52
+ export {};
@@ -7,8 +7,8 @@ var f = (o, e, s) => {
7
7
  e instanceof WeakSet ? e.add(o) : e.set(o, s);
8
8
  };
9
9
  import { DelaysPromise as R } from "../DelaysPromise/DelaysPromise.js";
10
- import { NetworkInformationCordova as d } from "../Utils/NetworkInformation/classes/NetworkInformationCordova.js";
11
- import { NetworkInformationPC as v } from "../Utils/NetworkInformation/classes/NetworkInformationPC.js";
10
+ import { NetworkInformationCordova as v } from "../Utils/NetworkInformation/classes/NetworkInformationCordova.js";
11
+ import { NetworkInformationPC as d } from "../Utils/NetworkInformation/classes/NetworkInformationPC.js";
12
12
  import { EventSubscribers as g } from "../Utils/EventSubscribers/EventSubscribers.js";
13
13
  import { NetworkInformation as O } from "../Utils/NetworkInformation/NetworkInformation.js";
14
14
  import { WsApi as S } from "./deps/WsApi/WsApi.js";
@@ -71,7 +71,7 @@ r = new WeakSet(), A = function() {
71
71
  isNetworkStatus: navigator.onLine
72
72
  }), n(t, "options", {
73
73
  isReConnectNetworkOnline: !1
74
- }), n(t, "wsApi", new S()), n(t, "delay", new R()), n(t, "internet", new O([new v(), new d()])), n(t, "events", new g(["timeOffReConnect", "reConnect"])), n(t, "saveID", {
74
+ }), n(t, "wsApi", new S()), n(t, "delay", new R()), n(t, "internet", new O([new d(), new v()])), n(t, "events", new g(["timeOffReConnect", "reConnect"])), n(t, "saveID", {
75
75
  idReConnect: null,
76
76
  checkConnect: null
77
77
  }), n(t, "stateDefault", t.copyState(t.state)), n(t, "setInfoConnect", (e) => {
@@ -91,8 +91,7 @@ n(t, "getState", () => t.state), n(t, "on", (e, s) => {
91
91
  t.wsApi.getRegisteredEvents().includes(e) ? t.wsApi.on(e, s) : t.events.subscribe(e, s);
92
92
  }), n(t, "off", (e, s) => {
93
93
  t.wsApi.getRegisteredEvents().includes(e) ? t.wsApi.off(e, s) : t.events.unsubscribe(e, s);
94
- }), // static getRequestSave = SocketApi.wsApi.getRequestSave;
95
- n(t, "getStatusSocket", t.wsApi.getStatusSocket), n(t, "close", () => {
94
+ }), n(t, "getRequestSave", t.wsApi.getRequestSave), n(t, "getStatusSocket", t.wsApi.getStatusSocket), n(t, "close", () => {
96
95
  t.state.isActiveReConnect ? t.stopReConnect(!1) : t.wsApi.close();
97
96
  }), n(t, "init", (e) => {
98
97
  const { WsOptions: s, SocketApiOptions: i } = t.splitOptions(e);
@@ -100,11 +99,6 @@ n(t, "getStatusSocket", t.wsApi.getStatusSocket), n(t, "close", () => {
100
99
  c ? t.online() : t.offline();
101
100
  }), t.setOptions(i), t.wsApi.init(s);
102
101
  }), /*------------------------------------------------------------------------------------------------------*/
103
- // useEffect(() => {
104
- // if((isReConnectSocket && (!isNetworkStatus || statusWS === 'ready'))){
105
- // SocketApi.stopReConnect();
106
- // }
107
- // },[isReConnectSocket, isNetworkStatus, statusWS]);
108
102
  n(t, "socketReConnect", () => {
109
103
  if (t.wsApi.getIsInitWS())
110
104
  if (console.log("reconnect"), t.saveID.idReConnect)
@@ -5,8 +5,8 @@ export interface WsApi_Options_P {
5
5
  }
6
6
  export type WsApiE_StatusConnect_OR = "pending" | "ready" | "error" | "close" | "disconnect";
7
7
  export interface WsApi_Events {
8
- status: (status: WsApiE_StatusConnect_OR) => void;
9
- msg: (message: any) => void;
8
+ status(status: WsApiE_StatusConnect_OR): void;
9
+ msg(message: any): void;
10
10
  }
11
11
  export interface WsApi_StateProps {
12
12
  statusConnect: WsApiE_StatusConnect_OR;
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.3.28",
14
+ "version": "1.3.30",
15
15
  "type": "module",
16
16
  "module": "./dist/index.js",
17
17
  "main": "./dist/index.js",
@@ -39,7 +39,7 @@
39
39
  "start": "vite",
40
40
  "build": "tsc && vite build",
41
41
  "preview": "vite preview",
42
- "publish": "node publishVersion.js"
42
+ "send": "node publishVersion.js"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/js-cookie": "^3.0.6",