dev-classes 1.3.26 → 1.3.28
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/README.md +4 -1
- package/dist/classes/DelaysPromise/DelaysPromise.js +53 -50
- package/dist/classes/DelaysPromise/DelaysPromise.types.d.ts +7 -4
- package/dist/classes/HTTPSApi/deps/apiRequest/apiRequest.js +245 -254
- package/dist/classes/SocketApi/SocketApi.d.ts +2 -2
- package/dist/classes/SocketApi/SocketApi.js +20 -20
- package/dist/classes/SocketApi/SocketApi.types.d.ts +5 -2
- package/dist/classes/SocketApi/index.d.ts +1 -1
- package/package.json +7 -6
package/README.md
CHANGED
|
@@ -146,7 +146,10 @@ interface OneOfPromiseReject{
|
|
|
146
146
|
|
|
147
147
|
|
|
148
148
|
interface DelaysPromiseProps{
|
|
149
|
-
|
|
149
|
+
startActionEvery: (cb: () => boolean, config: StartActionEveryConfigI) => {
|
|
150
|
+
stop: ControlAction['stop'],
|
|
151
|
+
promise: Promise<{status: boolean, msg: string}>
|
|
152
|
+
}
|
|
150
153
|
oneOf: (watchPromise: () => Promise<any>, potentialCaseCB: () => void, config: {second: number}) => void
|
|
151
154
|
oneOfPromise:(watchPromise: () => Promise<any>, cbPotentialReject: (p:OneOfPromiseReject) => OneOfPromiseReject, config: {second: number}) => Promise<any>
|
|
152
155
|
}
|
|
@@ -1,69 +1,72 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
class
|
|
1
|
+
var P = Object.defineProperty;
|
|
2
|
+
var h = (m, e, t) => e in m ? P(m, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : m[e] = t;
|
|
3
|
+
var A = (m, e, t) => (h(m, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
class O {
|
|
5
5
|
constructor() {
|
|
6
|
-
|
|
6
|
+
A(this, "defaultProps", {
|
|
7
7
|
interval: 5e3
|
|
8
8
|
});
|
|
9
|
-
|
|
10
|
-
const a = (
|
|
11
|
-
t != null && t.watchIdInterval && (t == null || t.watchIdInterval(
|
|
12
|
-
},
|
|
13
|
-
t != null && t.controlAction && (t == null || t.controlAction(
|
|
9
|
+
A(this, "startActionEvery", (e, t = this.defaultProps) => {
|
|
10
|
+
const a = (r) => {
|
|
11
|
+
t != null && t.watchIdInterval && (t == null || t.watchIdInterval(r));
|
|
12
|
+
}, u = (r) => {
|
|
13
|
+
t != null && t.controlAction && (t == null || t.controlAction(r));
|
|
14
|
+
};
|
|
15
|
+
let l = !0, s, n, I;
|
|
16
|
+
const v = (r = !0) => {
|
|
17
|
+
const p = "Ручное завершение startActionEvery";
|
|
18
|
+
l = !1, clearInterval(s), a(null), r ? n && n({ status: r, msg: p + ": (true)" }) : I && I({ status: r, msg: p + ": (false)" });
|
|
19
|
+
};
|
|
20
|
+
return {
|
|
21
|
+
promise: new Promise((r, p) => {
|
|
22
|
+
n = r, I = p;
|
|
23
|
+
let d = 0, o = 0;
|
|
24
|
+
s = setInterval(
|
|
25
|
+
() => {
|
|
26
|
+
if (d += t.interval, o += 1, t != null && t.cutoffTime && d > t.cutoffTime || t != null && t.countAction && (t == null ? void 0 : t.countAction) < o) {
|
|
27
|
+
l = !1, clearInterval(s), a(null), p({ status: !1, msg: Error("Время загрузки истекло") });
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
e() && (l = !1, clearInterval(s), a(null), r({ status: !0, msg: "cb вернул true" }));
|
|
31
|
+
},
|
|
32
|
+
t.interval < 200 ? 200 : t.interval
|
|
33
|
+
), a(s), u({
|
|
34
|
+
getIsActiveEvent: () => l,
|
|
35
|
+
stop: v
|
|
36
|
+
});
|
|
37
|
+
}),
|
|
38
|
+
stop: v
|
|
14
39
|
};
|
|
15
|
-
return new Promise((s, l) => {
|
|
16
|
-
let n = 0, m = 0;
|
|
17
|
-
const r = {
|
|
18
|
-
isActive: !0
|
|
19
|
-
}, A = setInterval(
|
|
20
|
-
() => {
|
|
21
|
-
if (n += t.interval, m += 1, t != null && t.cutoffTime && n > t.cutoffTime || t != null && t.countAction && (t == null ? void 0 : t.countAction) < m) {
|
|
22
|
-
r.isActive = !1, clearInterval(A), a(null), l({ status: !1, msg: Error("Время загрузки истекло") });
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
e() && (r.isActive = !1, clearInterval(A), a(null), s({ status: !0, msg: "cb вернул true" }));
|
|
26
|
-
},
|
|
27
|
-
t.interval < 200 ? 200 : t.interval
|
|
28
|
-
);
|
|
29
|
-
a(A), v({
|
|
30
|
-
getIsActiveEvent: () => r.isActive,
|
|
31
|
-
stop: (p) => {
|
|
32
|
-
const d = "Ручное завершение startActionEvery";
|
|
33
|
-
r.isActive = !1, clearInterval(A), a(null), p ? s({ status: p, msg: d + ": (true)" }) : l({ status: p, msg: d + ": (false)" });
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
40
|
});
|
|
38
|
-
|
|
39
|
-
let
|
|
41
|
+
A(this, "oneOf", (e, t, { second: a }) => {
|
|
42
|
+
let u = 1;
|
|
40
43
|
e().then(() => {
|
|
41
|
-
|
|
44
|
+
u === 1 && (u = 0);
|
|
42
45
|
});
|
|
43
|
-
let
|
|
44
|
-
|
|
46
|
+
let l = setInterval(() => {
|
|
47
|
+
u === 1 && t(), clearInterval(l);
|
|
45
48
|
}, a * 1e3);
|
|
46
49
|
});
|
|
47
|
-
|
|
48
|
-
let
|
|
49
|
-
e().then((
|
|
50
|
-
|
|
51
|
-
}).catch((
|
|
52
|
-
|
|
50
|
+
A(this, "oneOfPromise", (e, t, { second: a }) => new Promise((u, l) => {
|
|
51
|
+
let s = 1, n = { status: !1, msg: "" };
|
|
52
|
+
e().then((v) => {
|
|
53
|
+
s === 1 && (s = 0, u(v));
|
|
54
|
+
}).catch((v) => {
|
|
55
|
+
s === 1 && (s = 0, n.msg = v, l(v));
|
|
53
56
|
});
|
|
54
|
-
let
|
|
55
|
-
if (
|
|
56
|
-
if (
|
|
57
|
-
|
|
57
|
+
let I = setInterval(() => {
|
|
58
|
+
if (s === 1) {
|
|
59
|
+
if (s = 0, typeof t == "function") {
|
|
60
|
+
l({ status: !1, msg: "", ...t(n) });
|
|
58
61
|
return;
|
|
59
62
|
}
|
|
60
|
-
|
|
63
|
+
l({ status: !1, msg: "oneOfPromise reject" });
|
|
61
64
|
}
|
|
62
|
-
clearInterval(
|
|
65
|
+
clearInterval(I);
|
|
63
66
|
}, a * 1e3);
|
|
64
67
|
}));
|
|
65
68
|
}
|
|
66
69
|
}
|
|
67
70
|
export {
|
|
68
|
-
|
|
71
|
+
O as DelaysPromise
|
|
69
72
|
};
|
|
@@ -14,10 +14,13 @@ interface OneOfPromiseReject {
|
|
|
14
14
|
msg: string;
|
|
15
15
|
}
|
|
16
16
|
export interface DelaysPromiseProps {
|
|
17
|
-
startActionEvery: (cb: () => boolean, config: StartActionEveryConfigI) =>
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
startActionEvery: (cb: () => boolean, config: StartActionEveryConfigI) => {
|
|
18
|
+
stop: ControlAction['stop'];
|
|
19
|
+
promise: Promise<{
|
|
20
|
+
status: boolean;
|
|
21
|
+
msg: string;
|
|
22
|
+
}>;
|
|
23
|
+
};
|
|
21
24
|
oneOf: (watchPromise: () => Promise<any>, potentialCaseCB: () => void, config: {
|
|
22
25
|
second: number;
|
|
23
26
|
}) => void;
|