dev-classes 1.2.0 → 1.2.1
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/classes/SocketApi/SocketApi.d.ts +2 -3
- package/dist/classes/SocketApi/SocketApi.js +15 -16
- package/dist/classes/SocketApi/deps/WsApi/WsApi.d.ts +1 -2
- package/dist/classes/SocketApi/deps/WsApi/WsApi.js +3 -3
- package/dist/classes/SocketApi/deps/WsApi/WsApi.types.d.ts +1 -2
- package/package.json +1 -1
|
@@ -22,7 +22,7 @@ export declare class SocketApi {
|
|
|
22
22
|
static setOptions: (option?: ConnectOptions_P) => void;
|
|
23
23
|
static close(): void;
|
|
24
24
|
static disconnect(): void;
|
|
25
|
-
static send<ResType>(data: object,
|
|
25
|
+
static send<ResType>(data: object, cb?: (data: ResType) => void, cbError?: (err: Error) => void): void;
|
|
26
26
|
static connect(): void;
|
|
27
27
|
static stopReConnect(): void;
|
|
28
28
|
static resetState(): void;
|
|
@@ -33,8 +33,7 @@ export declare class SocketApi {
|
|
|
33
33
|
action: string;
|
|
34
34
|
};
|
|
35
35
|
reqId: string;
|
|
36
|
-
|
|
37
|
-
reject: any;
|
|
36
|
+
cb: any;
|
|
38
37
|
}[];
|
|
39
38
|
static watchReConnect(cb: WatchI["watchReConnect"]): void;
|
|
40
39
|
static watchTimeOffReConnect(cb: WatchI["watchTimeOffReConnect"]): void;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var c = (n, e, s) => (
|
|
4
|
-
import { WsApi as
|
|
5
|
-
const
|
|
6
|
-
function
|
|
7
|
-
return
|
|
1
|
+
var f = Object.defineProperty;
|
|
2
|
+
var p = (n, e, s) => e in n ? f(n, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : n[e] = s;
|
|
3
|
+
var c = (n, e, s) => (p(n, typeof e != "symbol" ? e + "" : e, s), s);
|
|
4
|
+
import { WsApi as u } from "./deps/WsApi/WsApi.js";
|
|
5
|
+
const C = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
6
|
+
function d(n) {
|
|
7
|
+
return C.test(n);
|
|
8
8
|
}
|
|
9
9
|
function i() {
|
|
10
10
|
var n = URL.createObjectURL(new Blob()), e = n.toString();
|
|
11
11
|
return URL.revokeObjectURL(n), e.split(/[:\/]/g).pop().toLowerCase();
|
|
12
12
|
}
|
|
13
|
-
i.valid =
|
|
14
|
-
class
|
|
13
|
+
i.valid = d;
|
|
14
|
+
class R {
|
|
15
15
|
watchTimeOffReConnect(e) {
|
|
16
16
|
}
|
|
17
17
|
watchReConnect(e) {
|
|
@@ -30,14 +30,13 @@ const t = class t {
|
|
|
30
30
|
static disconnect() {
|
|
31
31
|
t.state.isDisconnect || (t.state.isDisconnect = !0, console.log("DISCONNECT WS"), t.wsApi.internet.removeWatcherInternet(), t.wsApi.setStatus("disconnect"), t.resetSocket(), t.resetState(), t.wsApi.resetState());
|
|
32
32
|
}
|
|
33
|
-
static send(e, s,
|
|
33
|
+
static send(e, s, g) {
|
|
34
34
|
var a;
|
|
35
|
-
const { action:
|
|
35
|
+
const { action: r, ...w } = e, l = i();
|
|
36
36
|
if (t.wsApi.setRequestSave({
|
|
37
|
-
reqId:
|
|
38
|
-
payload: { action:
|
|
39
|
-
|
|
40
|
-
reject: r
|
|
37
|
+
reqId: l,
|
|
38
|
+
payload: { action: r, ...w },
|
|
39
|
+
cb: s
|
|
41
40
|
}), !t.wsApi.state.ws || t.wsApi.state.ws.readyState !== 1) {
|
|
42
41
|
console.log("Нет подключения к сокету. Данные запроса сохранены", t.wsApi.state.arrSaveReq);
|
|
43
42
|
return;
|
|
@@ -74,7 +73,7 @@ const t = class t {
|
|
|
74
73
|
console.log("CONNECT WS"), t.resetSocket(), t.state.isDisconnect = !1, t.wsApi.state.ws = new WebSocket(t.wsApi.configWs.url), t.wsApi.setStatus("pending"), t.wsApi.addEvents();
|
|
75
74
|
}
|
|
76
75
|
};
|
|
77
|
-
c(t, "wsApi", new
|
|
76
|
+
c(t, "wsApi", new u()), c(t, "watch", new R()), c(t, "state", {
|
|
78
77
|
isDisconnect: !0,
|
|
79
78
|
initConnect: !1,
|
|
80
79
|
isReConnect: !1
|
|
@@ -2,7 +2,7 @@ var h = Object.defineProperty;
|
|
|
2
2
|
var l = (i, n, e) => n in i ? h(i, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[n] = e;
|
|
3
3
|
var r = (i, n, e) => (l(i, typeof n != "symbol" ? n + "" : n, e), e);
|
|
4
4
|
import { DelaysPromise as c } from "../../../Delay/Delay.js";
|
|
5
|
-
import { InternetWatcher as
|
|
5
|
+
import { InternetWatcher as d } from "../InternetWatcher/InternetWatcher.js";
|
|
6
6
|
class p extends c {
|
|
7
7
|
constructor() {
|
|
8
8
|
super(...arguments);
|
|
@@ -11,7 +11,7 @@ class p extends c {
|
|
|
11
11
|
numberOfRepit: 5,
|
|
12
12
|
url: ""
|
|
13
13
|
});
|
|
14
|
-
r(this, "internet", new
|
|
14
|
+
r(this, "internet", new d());
|
|
15
15
|
r(this, "state", {
|
|
16
16
|
statusConnect: "disconnect",
|
|
17
17
|
ws: null,
|
|
@@ -95,7 +95,7 @@ class p extends c {
|
|
|
95
95
|
const t = this.getRequestSave(), s = [];
|
|
96
96
|
for (let a = 0; a < t.length; a++) {
|
|
97
97
|
const o = t[a];
|
|
98
|
-
o.payload.action !== e.action ? s.push(o) : o.
|
|
98
|
+
o.payload.action !== e.action ? s.push(o) : o.cb && o.cb(e);
|
|
99
99
|
}
|
|
100
100
|
this.state.arrSaveReq = s, console.log("filterArrSaveReq", s);
|
|
101
101
|
}
|