dev-classes 1.0.4 → 1.0.5

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,62 +1,62 @@
1
1
  var A = Object.defineProperty;
2
2
  var p = (o, e, t) => e in o ? A(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
- var i = (o, e, t) => (p(o, typeof e != "symbol" ? e + "" : e, t), t);
3
+ var I = (o, e, t) => (p(o, typeof e != "symbol" ? e + "" : e, t), t);
4
4
  class d {
5
5
  constructor() {
6
- i(this, "startActionEvery", (e, t = { interval: 5e3 }) => {
6
+ I(this, "startActionEvery", (e, t = { interval: 5e3 }) => {
7
7
  const r = (s) => {
8
8
  typeof (t == null ? void 0 : t.watchIdInterval) == "function" && (t == null || t.watchIdInterval(s));
9
- }, a = (s) => {
9
+ }, n = (s) => {
10
10
  typeof (t == null ? void 0 : t.controlAction) == "function" && (t == null || t.controlAction(s));
11
11
  };
12
- return new Promise((s, l) => {
13
- let v = 0, n = 0;
14
- const u = {
12
+ return new Promise((s, a) => {
13
+ let v = 0, u = 0;
14
+ const l = {
15
15
  isActive: !0
16
- }, I = setInterval(
16
+ }, m = setInterval(
17
17
  () => {
18
- if (v += t.interval, n += 1, t != null && t.cutoffTime && v > t.cutoffTime || t != null && t.countAction && (t == null ? void 0 : t.countAction) < n) {
19
- u.isActive = !1, clearInterval(I), r(null), l({ status: !1, msg: Error("Время загрузки истекло") });
18
+ if (v += t.interval, u += 1, t != null && t.cutoffTime && v > t.cutoffTime || t != null && t.countAction && (t == null ? void 0 : t.countAction) < u) {
19
+ l.isActive = !1, clearInterval(m), r(null), a({ status: !1, msg: Error("Время загрузки истекло") });
20
20
  return;
21
21
  }
22
- e() && (u.isActive = !1, clearInterval(I), r(null), s({ status: !0, msg: "cb вернул true" }));
22
+ e() && (l.isActive = !1, clearInterval(m), r(null), s({ status: !0, msg: "cb вернул true" }));
23
23
  },
24
24
  t.interval < 200 ? 200 : t.interval
25
25
  );
26
- r(I), a({
27
- getIsActiveEvent: () => u.isActive,
26
+ r(m), n({
27
+ getIsActiveEvent: () => l.isActive,
28
28
  stop: () => {
29
- const m = "Ручное завершение startActionEvery";
30
- console.dir(`controlAction (stop): ${m}`), u.isActive = !1, clearInterval(I), r(null), s({ status: !0, msg: m });
29
+ const i = "Ручное завершение startActionEvery";
30
+ console.dir(`controlAction (stop): ${i}`), l.isActive = !1, clearInterval(m), r(null), s({ status: !0, msg: i });
31
31
  }
32
32
  });
33
33
  });
34
34
  });
35
- i(this, "oneOf", (e, t, { second: r }) => {
36
- let a = 1;
35
+ I(this, "oneOf", (e, t, { second: r }) => {
36
+ let n = 1;
37
37
  e().then(() => {
38
- a === 1 && (a = 0);
38
+ n === 1 && (n = 0);
39
39
  });
40
40
  let s = setInterval(() => {
41
- console.dir("setInterval в oneOf"), a === 1 && t(), clearInterval(s);
41
+ console.dir("setInterval в oneOf"), n === 1 && t(), clearInterval(s);
42
42
  }, r * 1e3);
43
43
  });
44
- i(this, "oneOfPromise", (e, t, { second: r }) => new Promise((a, s) => {
45
- let l = 1;
46
- e().then((n) => {
47
- console.log("DelaysPromise.oneOfPromise (promiseWatch ==> data)", n), l === 1 && (l = 0, a(n));
48
- }).catch((n) => {
49
- l === 1 && (l = 0, s(n));
44
+ I(this, "oneOfPromise", (e, t, { second: r }) => new Promise((n, s) => {
45
+ let a = 1, v = { status: !1, msg: "" };
46
+ e().then((l) => {
47
+ console.log("DelaysPromise.oneOfPromise (promiseWatch ==> data)", l), a === 1 && (a = 0, n(l));
48
+ }).catch((l) => {
49
+ a === 1 && (a = 0, v.msg = l, s(l));
50
50
  });
51
- let v = setInterval(() => {
52
- if (console.log("DelaysPromise.oneOfPromise (interval ==> potentialCaseCB)"), l === 1) {
53
- if (l = 0, typeof t == "function") {
54
- s({ status: !1, msg: "", ...t() });
51
+ let u = setInterval(() => {
52
+ if (console.log("DelaysPromise.oneOfPromise (interval ==> potentialCaseCB)"), a === 1) {
53
+ if (a = 0, typeof t == "function") {
54
+ s({ status: !1, msg: "", ...t(v) });
55
55
  return;
56
56
  }
57
57
  s({ status: !1, msg: "oneOfPromise reject" });
58
58
  }
59
- clearInterval(v);
59
+ clearInterval(u);
60
60
  }, r * 1e3);
61
61
  }));
62
62
  }
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "url": "git+https://github.com/SinGlEBW/dev-classes.git"
8
8
  },
9
9
  "license": "MIT",
10
- "version": "1.0.4",
10
+ "version": "1.0.5",
11
11
  "type": "module",
12
12
  "module": "./dist/index.js",
13
13
  "main": "./dist/index.js",