dev-classes 1.2.3 → 1.3.4
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 +250 -0
- package/dist/classes/Color/Color.d.ts +28 -37
- package/dist/classes/Color/Color.js +167 -205
- package/dist/classes/Color/Color.types.d.ts +36 -0
- package/dist/classes/Color/Color.types.js +1 -0
- package/dist/classes/Color/index.d.ts +2 -0
- package/dist/classes/Color/index.js +4 -0
- package/dist/classes/DateProcessing/DateProcessing.d.ts +30 -78
- package/dist/classes/DateProcessing/DateProcessing.js +2 -1
- package/dist/classes/DateProcessing/DateProcessing.types.d.ts +50 -0
- package/dist/classes/DateProcessing/DateProcessing.types.js +5 -0
- package/dist/classes/DateProcessing/index.d.ts +2 -0
- package/dist/classes/DateProcessing/index.js +4 -0
- package/dist/classes/DelaysPromise/DelaysPromise.d.ts +8 -0
- package/dist/classes/DelaysPromise/DelaysPromise.js +69 -0
- package/dist/classes/DelaysPromise/DelaysPromise.types.d.ts +28 -0
- package/dist/classes/DelaysPromise/DelaysPromise.types.js +1 -0
- package/dist/classes/DelaysPromise/index.d.ts +2 -0
- package/dist/classes/DelaysPromise/index.js +4 -0
- package/dist/classes/File/File.d.ts +8 -0
- package/dist/classes/File/File.js +22 -0
- package/dist/classes/File/File.types.d.ts +7 -0
- package/dist/classes/File/File.types.js +1 -0
- package/dist/classes/File/index.d.ts +2 -0
- package/dist/classes/File/index.js +4 -0
- package/dist/classes/HTTPSApi/HTTPSApi.d.ts +14 -4
- package/dist/classes/HTTPSApi/HTTPSApi.js +61 -38
- package/dist/classes/HTTPSApi/HTTPSApi.types.d.ts +3 -0
- package/dist/classes/HTTPSApi/index.d.ts +2 -0
- package/dist/classes/HTTPSApi/index.js +4 -0
- package/dist/classes/Numbers/Numbers.d.ts +5 -3
- package/dist/classes/Numbers/Numbers.js +17 -20
- package/dist/classes/Numbers/Numbers.types.d.ts +5 -0
- package/dist/classes/Numbers/Numbers.types.js +1 -0
- package/dist/classes/Numbers/index.d.ts +2 -0
- package/dist/classes/Numbers/index.js +4 -0
- package/dist/classes/SocketApi/SocketApi.d.ts +25 -38
- package/dist/classes/SocketApi/SocketApi.js +112 -84
- package/dist/classes/SocketApi/SocketApi.types.d.ts +6 -0
- package/dist/classes/SocketApi/SocketApi.types.js +1 -0
- package/dist/classes/SocketApi/deps/WsApi/WsApi.d.ts +31 -26
- package/dist/classes/SocketApi/deps/WsApi/WsApi.js +91 -69
- package/dist/classes/SocketApi/deps/WsApi/WsApi.types.d.ts +7 -22
- package/dist/classes/SocketApi/deps/WsApi/index.d.ts +1 -1
- package/dist/classes/SocketApi/index.d.ts +2 -0
- package/dist/classes/SocketApi/index.js +4 -0
- package/dist/classes/Utils/EventSubscribers/EventSubscribers.d.ts +14 -0
- package/dist/classes/Utils/EventSubscribers/EventSubscribers.js +33 -0
- package/dist/classes/Utils/EventSubscribers/EventSubscribers.types.d.ts +9 -0
- package/dist/classes/Utils/EventSubscribers/EventSubscribers.types.js +1 -0
- package/dist/classes/Utils/EventSubscribers/index.d.ts +2 -0
- package/dist/classes/Utils/EventSubscribers/index.js +4 -0
- package/dist/classes/Utils/NetworkInformation/NetworkInformation.d.ts +9 -0
- package/dist/classes/Utils/NetworkInformation/NetworkInformation.js +24 -0
- package/dist/classes/Utils/NetworkInformation/classes/InternetWatchers.d.ts +6 -0
- package/dist/classes/Utils/NetworkInformation/classes/InternetWatchers.js +39 -0
- package/dist/classes/Utils/NetworkInformation/classes/NetworkInformationCordova.d.ts +11 -0
- package/dist/classes/Utils/NetworkInformation/classes/NetworkInformationCordova.js +26 -0
- package/dist/classes/Utils/NetworkInformation/classes/NetworkInformationPC.d.ts +11 -0
- package/dist/classes/Utils/NetworkInformation/classes/NetworkInformationPC.js +22 -0
- package/dist/classes/Utils/NetworkInformation/classes/index.d.ts +2 -0
- package/dist/classes/Utils/NetworkInformation/classes/index.js +6 -0
- package/dist/classes/Utils/NetworkInformation/classes/types/types.abscruct.d.ts +10 -0
- package/dist/classes/Utils/NetworkInformation/classes/types/types.abscruct.js +5 -0
- package/dist/classes/Utils/NetworkInformation/index.d.ts +4 -0
- package/dist/classes/Utils/NetworkInformation/index.js +10 -0
- package/dist/classes/Utils/Utils.d.ts +4 -4
- package/dist/classes/Utils/Utils.js +34 -39
- package/dist/classes/Utils/Utils.types.d.ts +17 -0
- package/dist/classes/Utils/Utils.types.js +1 -0
- package/dist/index.d.ts +9 -9
- package/dist/index.js +26 -20
- package/package.json +16 -2
- package/dist/classes/Delay/Delay.d.ts +0 -26
- package/dist/classes/Delay/Delay.js +0 -66
- package/dist/classes/DownloadFile/DownloadFile.d.ts +0 -8
- package/dist/classes/DownloadFile/DownloadFile.js +0 -23
- package/dist/classes/ProcessingWS/ProcessingWS.d.ts +0 -11
- package/dist/classes/ProcessingWS/ProcessingWS.js +0 -20
- package/dist/classes/SocketApi/deps/InternetWatcher/InternetWatcher.d.ts +0 -8
- package/dist/classes/SocketApi/deps/InternetWatcher/InternetWatcher.js +0 -24
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
var i = Object.defineProperty;
|
|
2
|
+
var a = (r, t, o) => t in r ? i(r, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : r[t] = o;
|
|
3
|
+
var e = (r, t, o) => (a(r, typeof t != "symbol" ? t + "" : t, o), o);
|
|
4
|
+
class m {
|
|
5
|
+
constructor(t) {
|
|
6
|
+
e(this, "listNetworkInformation", []);
|
|
7
|
+
this.listNetworkInformation = t;
|
|
8
|
+
}
|
|
9
|
+
getSystem() {
|
|
10
|
+
return window != null && window.cordova ? "cordova" : "pc";
|
|
11
|
+
}
|
|
12
|
+
run(t) {
|
|
13
|
+
const o = this.getSystem(), s = this.listNetworkInformation.find((n) => n.getControls().system === o);
|
|
14
|
+
s ? s.getControls().addWatchers(t) : console.error("NetworkInformation не активен на данной платформе");
|
|
15
|
+
}
|
|
16
|
+
stop() {
|
|
17
|
+
this.listNetworkInformation.forEach((t) => {
|
|
18
|
+
t.getControls().removeWatchers();
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
m as NetworkInformation
|
|
24
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
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);
|
|
4
|
+
const l = {
|
|
5
|
+
isNetworkStatus: window.navigator.onLine,
|
|
6
|
+
listCloseSignals: [],
|
|
7
|
+
isWatcher: !1
|
|
8
|
+
};
|
|
9
|
+
class g {
|
|
10
|
+
constructor() {
|
|
11
|
+
i(this, "state", l);
|
|
12
|
+
i(this, "resetState", () => this.state = l);
|
|
13
|
+
}
|
|
14
|
+
addWatchers(t) {
|
|
15
|
+
if (!this.state.isWatcher) {
|
|
16
|
+
this.state.isWatcher = !0;
|
|
17
|
+
const s = [
|
|
18
|
+
{ event: "online", status: !0 },
|
|
19
|
+
{ event: "offline", status: !1 }
|
|
20
|
+
];
|
|
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 });
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
removeWatchers() {
|
|
28
|
+
if (this.state.isWatcher) {
|
|
29
|
+
for (let t = 0; t < this.state.listCloseSignals.length; t++) {
|
|
30
|
+
const s = this.state.listCloseSignals[t];
|
|
31
|
+
s == null || s.abort();
|
|
32
|
+
}
|
|
33
|
+
this.resetState();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
g as InternetWatchers
|
|
39
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { NetworkInformationAbstract, WatcherCB } from './types/types.abscruct';
|
|
2
|
+
|
|
3
|
+
export type CordovaNetworkStatus = 'unknown' | 'none' | 'wifi' | '2g' | '3g' | '4g';
|
|
4
|
+
export declare class NetworkInformationCordova extends NetworkInformationAbstract {
|
|
5
|
+
protected watchers: (cb: WatcherCB) => void;
|
|
6
|
+
getControls: () => {
|
|
7
|
+
system: "cordova";
|
|
8
|
+
addWatchers: (cb: WatcherCB) => void;
|
|
9
|
+
removeWatchers: () => void;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
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);
|
|
4
|
+
import { NetworkInformationAbstract as i } from "./types/types.abscruct.js";
|
|
5
|
+
class d extends i {
|
|
6
|
+
constructor() {
|
|
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"));
|
|
13
|
+
};
|
|
14
|
+
navigator == null || navigator.connection.getInfo(a, c);
|
|
15
|
+
});
|
|
16
|
+
n(this, "getControls", () => ({
|
|
17
|
+
system: "cordova",
|
|
18
|
+
addWatchers: this.watchers,
|
|
19
|
+
removeWatchers: () => {
|
|
20
|
+
}
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
d as NetworkInformationCordova
|
|
26
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { NetworkInformationAbstract, WatcherCB } from './types/types.abscruct';
|
|
2
|
+
|
|
3
|
+
export declare class NetworkInformationPC extends NetworkInformationAbstract {
|
|
4
|
+
private network;
|
|
5
|
+
protected watchers: (cb: WatcherCB) => void;
|
|
6
|
+
getControls: () => {
|
|
7
|
+
system: "pc";
|
|
8
|
+
addWatchers: (cb: WatcherCB) => void;
|
|
9
|
+
removeWatchers: () => void;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
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";
|
|
5
|
+
import { NetworkInformationAbstract as h } from "./types/types.abscruct.js";
|
|
6
|
+
class w extends h {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
o(this, "network", new n());
|
|
10
|
+
o(this, "watchers", (t) => {
|
|
11
|
+
navigator.onLine ? t(!0) : t(!1), this.network.addWatchers(t);
|
|
12
|
+
});
|
|
13
|
+
o(this, "getControls", () => ({
|
|
14
|
+
system: "pc",
|
|
15
|
+
addWatchers: this.watchers,
|
|
16
|
+
removeWatchers: this.network.removeWatchers
|
|
17
|
+
}));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
w as NetworkInformationPC
|
|
22
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type SystemType = 'pc' | 'cordova';
|
|
2
|
+
export type WatcherCB = (status: boolean) => void;
|
|
3
|
+
export declare abstract class NetworkInformationAbstract {
|
|
4
|
+
protected abstract watchers(cb: WatcherCB): void;
|
|
5
|
+
abstract getControls(): {
|
|
6
|
+
system: SystemType;
|
|
7
|
+
addWatchers: (cb: WatcherCB) => void;
|
|
8
|
+
removeWatchers: () => void;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { NetworkInformation } from './NetworkInformation';
|
|
2
|
+
export { NetworkInformationPC } from './classes/NetworkInformationPC';
|
|
3
|
+
export { NetworkInformationAbstract } from './classes/types/types.abscruct';
|
|
4
|
+
export { NetworkInformationCordova, type CordovaNetworkStatus } from './classes/NetworkInformationCordova';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NetworkInformation as t } from "./NetworkInformation.js";
|
|
2
|
+
import { NetworkInformationPC as f } from "./classes/NetworkInformationPC.js";
|
|
3
|
+
import { NetworkInformationAbstract as n } from "./classes/types/types.abscruct.js";
|
|
4
|
+
import { NetworkInformationCordova as i } from "./classes/NetworkInformationCordova.js";
|
|
5
|
+
export {
|
|
6
|
+
t as NetworkInformation,
|
|
7
|
+
n as NetworkInformationAbstract,
|
|
8
|
+
i as NetworkInformationCordova,
|
|
9
|
+
f as NetworkInformationPC
|
|
10
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { UtilsProps } from './Utils.types';
|
|
2
|
+
|
|
1
3
|
export declare class Utils {
|
|
2
|
-
static events
|
|
3
|
-
static sortDataByAlphabet:
|
|
4
|
-
[key: string]: any;
|
|
5
|
-
}[], sortKey: string) => void;
|
|
4
|
+
static events: UtilsProps['events'];
|
|
5
|
+
static sortDataByAlphabet: UtilsProps['sortDataByAlphabet'];
|
|
6
6
|
static sortDataByDate: (data: any[], keyDate: string) => void;
|
|
7
7
|
static sortDataByDateAndTime: (data: any[], keyDate: string) => void;
|
|
8
8
|
private static splitDateFromTime;
|
|
@@ -1,49 +1,44 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var c = (
|
|
1
|
+
var u = Object.defineProperty;
|
|
2
|
+
var h = (f, e, t) => e in f ? u(f, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : f[e] = t;
|
|
3
|
+
var c = (f, e, t) => (h(f, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
4
|
const a = class a {
|
|
5
|
-
static events(t, e, r, s = "") {
|
|
6
|
-
return console.log(`##########--------<{ ${t === "add" ? "Создаём" : "Удаляем"} пачку ивентов ${s}}>---------#########`), new Promise((n, u) => {
|
|
7
|
-
let d = 0;
|
|
8
|
-
for (let [f, D] of r)
|
|
9
|
-
d++, t === "add" ? e.addEventListener ? e.addEventListener(f, D) : e.on ? e.on(f, D) : console.log("Utils.events:>> ", 'Отсутствует метод "addEventListener"') : e.removeEventListener ? e.removeEventListener(f, D) : e.off ? e.off(f, D) : console.log("Utils.events:>> ", 'Отсутствует метод "removeEventListener"'), d === r.length && n("");
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
5
|
};
|
|
13
|
-
c(a, "
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}), c(a, "
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
6
|
+
c(a, "events", (e, t, r, s = "") => new Promise((D, d) => {
|
|
7
|
+
let l = 0;
|
|
8
|
+
for (let [n, M] of r)
|
|
9
|
+
l++, e === "add" ? t.addEventListener(n, M) : t.removeEventListener(n, M), l === r.length && D("");
|
|
10
|
+
})), c(a, "sortDataByAlphabet", (e, t) => e.sort((r, s) => s[t].trim() < r[t].trim() ? 1 : -1)), c(a, "sortDataByDate", (e, t) => {
|
|
11
|
+
e.sort((r, s) => a.hasDateLessPeriod(s[t], r[t]) ? 1 : -1);
|
|
12
|
+
}), c(a, "sortDataByDateAndTime", (e, t) => {
|
|
13
|
+
}), c(a, "splitDateFromTime", (e) => e.split(" ")), c(a, "reverseDate", (e) => {
|
|
14
|
+
let [t, r] = a.splitDateFromTime(e);
|
|
15
|
+
return t.split(".").reverse().join("-");
|
|
16
|
+
}), c(a, "correctionDataISO8601", (e) => {
|
|
17
|
+
let t = "";
|
|
18
|
+
if (/^\d{2}\.\d{2}\.\d{4}$/.test(e) || /^\d{2}\.\d{2}\.\d{4}\s\d{2}:\d{2}$/.test(e))
|
|
19
|
+
t = a.reverseDate(e);
|
|
20
|
+
else if (/^\d{4}-\d{2}-\d{2}$/.test(e))
|
|
21
|
+
t = e;
|
|
27
22
|
else
|
|
28
|
-
throw new Error(`функция correctionDataISO8601 >> date не корректна: ${
|
|
29
|
-
return
|
|
30
|
-
}), c(a, "hasDateLessPeriod", (
|
|
31
|
-
if (
|
|
32
|
-
return Math.floor(Number(new Date(
|
|
23
|
+
throw new Error(`функция correctionDataISO8601 >> date не корректна: ${e}. Требуется один из форматов: дд.мм.гггг | дд.мм.гггг мм:чч | гггг-мм-дд `);
|
|
24
|
+
return t;
|
|
25
|
+
}), c(a, "hasDateLessPeriod", (e, t, r) => {
|
|
26
|
+
if (e = a.correctionDataISO8601(e), t = a.correctionDataISO8601(t), !r || r && !r.dateMinMax || (r == null ? void 0 : r.dateMinMax) === "<=")
|
|
27
|
+
return Math.floor(Number(new Date(e))) <= Math.floor(Number(new Date(t)));
|
|
33
28
|
if (r && (r == null ? void 0 : r.dateMinMax) === ">=")
|
|
34
|
-
return Math.floor(Number(new Date(
|
|
29
|
+
return Math.floor(Number(new Date(e))) >= Math.floor(Number(new Date(t)));
|
|
35
30
|
if (r && (r == null ? void 0 : r.dateMinMax) === "<")
|
|
36
|
-
return Math.floor(Number(new Date(
|
|
31
|
+
return Math.floor(Number(new Date(e))) < Math.floor(Number(new Date(t)));
|
|
37
32
|
if (r && (r == null ? void 0 : r.dateMinMax) === ">")
|
|
38
|
-
return Math.floor(Number(new Date(
|
|
39
|
-
}), c(a, "getEndsWithArr", (
|
|
40
|
-
const
|
|
41
|
-
for (const
|
|
42
|
-
Object.prototype.hasOwnProperty.call(s,
|
|
33
|
+
return Math.floor(Number(new Date(e))) > Math.floor(Number(new Date(t)));
|
|
34
|
+
}), c(a, "getEndsWithArr", (e, t) => e.slice(-t)), c(a, "deepMerge", (...e) => {
|
|
35
|
+
const t = {}, r = (s) => {
|
|
36
|
+
for (const D in s)
|
|
37
|
+
Object.prototype.hasOwnProperty.call(s, D) && (Object.prototype.toString.call(s[D]) === "[object Object]" ? t[D] = a.deepMerge(t[D], s[D]) : t[D] = s[D]);
|
|
43
38
|
};
|
|
44
|
-
for (let s = 0; s <
|
|
45
|
-
r(
|
|
46
|
-
return
|
|
39
|
+
for (let s = 0; s < e.length; s++)
|
|
40
|
+
r(e[s]);
|
|
41
|
+
return t;
|
|
47
42
|
});
|
|
48
43
|
let m = a;
|
|
49
44
|
export {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface UtilsProps {
|
|
2
|
+
events(status: 'add' | 'remove', who: EventTarget, entriesEvents: any, msg: string): Promise<string>;
|
|
3
|
+
sortDataByAlphabet(arrData: {
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
}[], sortKey: string): {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}[];
|
|
8
|
+
sortDataByDate(data: any[], keyDate: string): string[];
|
|
9
|
+
sortDataByDateAndTime(data: any[], keyDate: string): string[];
|
|
10
|
+
reverseDate(datePPR: string): string;
|
|
11
|
+
correctionDataISO8601(date: string): string;
|
|
12
|
+
hasDateLessPeriod(date: string, period: string, option?: {
|
|
13
|
+
dateMinMax: '<=' | '>=' | '<' | '>';
|
|
14
|
+
}): boolean;
|
|
15
|
+
getEndsWithArr(arr: any[], countEnd: number): any[];
|
|
16
|
+
deepMerge<T extends object = object>(...itemsOb: T[]): T;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export * from './classes/Color
|
|
2
|
-
export * from './classes/
|
|
3
|
-
export * from './classes/
|
|
4
|
-
export * from './classes/
|
|
5
|
-
export * from './classes/
|
|
6
|
-
export * from './classes/Numbers
|
|
7
|
-
export * from './classes/
|
|
1
|
+
export * from './classes/Color';
|
|
2
|
+
export * from './classes/DateProcessing';
|
|
3
|
+
export * from './classes/DelaysPromise';
|
|
4
|
+
export * from './classes/File';
|
|
5
|
+
export * from './classes/HTTPSApi';
|
|
6
|
+
export * from './classes/Numbers';
|
|
7
|
+
export * from './classes/SocketApi';
|
|
8
8
|
export * from './classes/Utils/Utils';
|
|
9
|
-
export * from './classes/
|
|
10
|
-
export * from './classes/
|
|
9
|
+
export * from './classes/Utils/EventSubscribers';
|
|
10
|
+
export * from './classes/Utils/NetworkInformation';
|
package/dist/index.js
CHANGED
|
@@ -1,22 +1,28 @@
|
|
|
1
|
-
import { Color as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { Numbers as
|
|
7
|
-
import {
|
|
8
|
-
import { Utils as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
1
|
+
import { Color as t } from "./classes/Color/Color.js";
|
|
2
|
+
import { DateProcessing as m } from "./classes/DateProcessing/DateProcessing.js";
|
|
3
|
+
import { DelaysPromise as p } from "./classes/DelaysPromise/DelaysPromise.js";
|
|
4
|
+
import { File as i } from "./classes/File/File.js";
|
|
5
|
+
import { HTTPSApi as s } from "./classes/HTTPSApi/HTTPSApi.js";
|
|
6
|
+
import { Numbers as k } from "./classes/Numbers/Numbers.js";
|
|
7
|
+
import { SocketApi as b } from "./classes/SocketApi/SocketApi.js";
|
|
8
|
+
import { Utils as l } from "./classes/Utils/Utils.js";
|
|
9
|
+
import { EventSubscribers as I } from "./classes/Utils/EventSubscribers/EventSubscribers.js";
|
|
10
|
+
import { NetworkInformation as A } from "./classes/Utils/NetworkInformation/NetworkInformation.js";
|
|
11
|
+
import { NetworkInformationPC as S } from "./classes/Utils/NetworkInformation/classes/NetworkInformationPC.js";
|
|
12
|
+
import { NetworkInformationAbstract as v } from "./classes/Utils/NetworkInformation/classes/types/types.abscruct.js";
|
|
13
|
+
import { NetworkInformationCordova as T } from "./classes/Utils/NetworkInformation/classes/NetworkInformationCordova.js";
|
|
11
14
|
export {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
t as Color,
|
|
16
|
+
m as DateProcessing,
|
|
17
|
+
p as DelaysPromise,
|
|
18
|
+
I as EventSubscribers,
|
|
19
|
+
i as File,
|
|
20
|
+
s as HTTPSApi,
|
|
21
|
+
A as NetworkInformation,
|
|
22
|
+
v as NetworkInformationAbstract,
|
|
23
|
+
T as NetworkInformationCordova,
|
|
24
|
+
S as NetworkInformationPC,
|
|
25
|
+
k as Numbers,
|
|
26
|
+
b as SocketApi,
|
|
27
|
+
l as Utils
|
|
22
28
|
};
|
package/package.json
CHANGED
|
@@ -6,8 +6,12 @@
|
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/SinGlEBW/dev-classes.git"
|
|
8
8
|
},
|
|
9
|
+
"bugs": {
|
|
10
|
+
"url": "https://github.com/SinGlEBW/dev-classes/issues"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://github.com/SinGlEBW/dev-classes#readme",
|
|
9
13
|
"license": "MIT",
|
|
10
|
-
"version": "1.
|
|
14
|
+
"version": "1.3.4",
|
|
11
15
|
"type": "module",
|
|
12
16
|
"module": "./dist/index.js",
|
|
13
17
|
"main": "./dist/index.js",
|
|
@@ -19,7 +23,17 @@
|
|
|
19
23
|
"directory": "dist"
|
|
20
24
|
},
|
|
21
25
|
"keywords": [
|
|
22
|
-
"dev-classes"
|
|
26
|
+
"dev-classes",
|
|
27
|
+
"SocketApi",
|
|
28
|
+
"EventSubscribers",
|
|
29
|
+
"NetworkInformation",
|
|
30
|
+
"HTTPSApi",
|
|
31
|
+
"DelaysPromise",
|
|
32
|
+
"Color",
|
|
33
|
+
"DateProcessing",
|
|
34
|
+
"File",
|
|
35
|
+
"Utils",
|
|
36
|
+
"Numbers"
|
|
23
37
|
],
|
|
24
38
|
"scripts": {
|
|
25
39
|
"start": "vite",
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
interface StartActionEveryConfigI {
|
|
2
|
-
interval: number;
|
|
3
|
-
cutoffTime?: number;
|
|
4
|
-
countAction?: number;
|
|
5
|
-
watchIdInterval?(id: number | null): void;
|
|
6
|
-
controlAction?(control: {
|
|
7
|
-
stop(): void;
|
|
8
|
-
getIsActiveEvent(): boolean;
|
|
9
|
-
}): void;
|
|
10
|
-
}
|
|
11
|
-
export interface DelaysPromiseProps {
|
|
12
|
-
startActionEvery: (cb: () => boolean, config: StartActionEveryConfigI) => Promise<{
|
|
13
|
-
status: boolean;
|
|
14
|
-
msg: string;
|
|
15
|
-
}>;
|
|
16
|
-
}
|
|
17
|
-
export declare class DelaysPromise {
|
|
18
|
-
startActionEvery: DelaysPromiseProps['startActionEvery'];
|
|
19
|
-
oneOf: (promiseWatch: any, potentialCaseCB: any, { second }: {
|
|
20
|
-
second: any;
|
|
21
|
-
}) => void;
|
|
22
|
-
oneOfPromise: (promiseWatch: any, cbPotentialReject: any, { second }: {
|
|
23
|
-
second: any;
|
|
24
|
-
}) => Promise<unknown>;
|
|
25
|
-
}
|
|
26
|
-
export {};
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
var p = Object.defineProperty;
|
|
2
|
-
var d = (u, e, t) => e in u ? p(u, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[e] = t;
|
|
3
|
-
var A = (u, e, t) => (d(u, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
-
class y {
|
|
5
|
-
constructor() {
|
|
6
|
-
A(this, "startActionEvery", (e, t = { interval: 5e3 }) => {
|
|
7
|
-
const r = (s) => {
|
|
8
|
-
typeof (t == null ? void 0 : t.watchIdInterval) == "function" && (t == null || t.watchIdInterval(s));
|
|
9
|
-
}, v = (s) => {
|
|
10
|
-
typeof (t == null ? void 0 : t.controlAction) == "function" && (t == null || t.controlAction(s));
|
|
11
|
-
};
|
|
12
|
-
return new Promise((s, a) => {
|
|
13
|
-
let n = 0, I = 0;
|
|
14
|
-
const l = {
|
|
15
|
-
isActive: !0
|
|
16
|
-
}, m = setInterval(
|
|
17
|
-
() => {
|
|
18
|
-
if (n += t.interval, I += 1, t != null && t.cutoffTime && n > t.cutoffTime || t != null && t.countAction && (t == null ? void 0 : t.countAction) < I) {
|
|
19
|
-
l.isActive = !1, clearInterval(m), r(null), a({ status: !1, msg: Error("Время загрузки истекло") });
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
e() && (l.isActive = !1, clearInterval(m), r(null), s({ status: !0, msg: "cb вернул true" }));
|
|
23
|
-
},
|
|
24
|
-
t.interval < 200 ? 200 : t.interval
|
|
25
|
-
);
|
|
26
|
-
r(m), v({
|
|
27
|
-
getIsActiveEvent: () => l.isActive,
|
|
28
|
-
stop: () => {
|
|
29
|
-
const o = "Ручное завершение startActionEvery";
|
|
30
|
-
l.isActive = !1, clearInterval(m), r(null), s({ status: !0, msg: o });
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
A(this, "oneOf", (e, t, { second: r }) => {
|
|
36
|
-
let v = 1;
|
|
37
|
-
e().then(() => {
|
|
38
|
-
v === 1 && (v = 0);
|
|
39
|
-
});
|
|
40
|
-
let s = setInterval(() => {
|
|
41
|
-
v === 1 && t(), clearInterval(s);
|
|
42
|
-
}, r * 1e3);
|
|
43
|
-
});
|
|
44
|
-
A(this, "oneOfPromise", (e, t, { second: r }) => new Promise((v, s) => {
|
|
45
|
-
let a = 1, n = { status: !1, msg: "" };
|
|
46
|
-
e().then((l) => {
|
|
47
|
-
a === 1 && (a = 0, v(l));
|
|
48
|
-
}).catch((l) => {
|
|
49
|
-
a === 1 && (a = 0, n.msg = l, s(l));
|
|
50
|
-
});
|
|
51
|
-
let I = setInterval(() => {
|
|
52
|
-
if (a === 1) {
|
|
53
|
-
if (a = 0, typeof t == "function") {
|
|
54
|
-
s({ status: !1, msg: "", ...t(n) });
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
s({ status: !1, msg: "oneOfPromise reject" });
|
|
58
|
-
}
|
|
59
|
-
clearInterval(I);
|
|
60
|
-
}, r * 1e3);
|
|
61
|
-
}));
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
export {
|
|
65
|
-
y as DelaysPromise
|
|
66
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare class DownloadFile {
|
|
2
|
-
private static startSrt;
|
|
3
|
-
private static applications;
|
|
4
|
-
private static getDataApplication;
|
|
5
|
-
static convertBase64To(attachment: Record<'name' | 'base64', string> & {
|
|
6
|
-
format: keyof typeof DownloadFile.applications;
|
|
7
|
-
}): void;
|
|
8
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
var d = Object.defineProperty;
|
|
2
|
-
var m = (e, t, a) => t in e ? d(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a;
|
|
3
|
-
var n = (e, t, a) => (m(e, typeof t != "symbol" ? t + "" : t, a), a);
|
|
4
|
-
const s = class s {
|
|
5
|
-
static getDataApplication(t) {
|
|
6
|
-
const { applications: a } = s;
|
|
7
|
-
return a[t] ? a[t] : a.pdf;
|
|
8
|
-
}
|
|
9
|
-
static convertBase64To(t) {
|
|
10
|
-
const { format: a, name: o, base64: i } = t, p = `${s.getDataApplication(a)}base64,${i}`, c = document.createElement("a"), l = `${o}.${a}`;
|
|
11
|
-
c.href = p, c.download = l, c.click();
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
n(s, "startSrt", "data:application/"), n(s, "applications", {
|
|
15
|
-
xls: `${s.startSrt}vnd.ms-excel;`,
|
|
16
|
-
xlsx: `${s.startSrt}vnd.openxmlformats-officedocument.spreadsheetml.sheet;`,
|
|
17
|
-
pdf: `${s.startSrt}pdf;`,
|
|
18
|
-
csv: `${s.startSrt}vnd.ms-excel;`
|
|
19
|
-
});
|
|
20
|
-
let r = s;
|
|
21
|
-
export {
|
|
22
|
-
r as DownloadFile
|
|
23
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
var c = Object.defineProperty;
|
|
2
|
-
var p = (i, t, e) => t in i ? c(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
|
|
3
|
-
var m = (i, t, e) => (p(i, typeof t != "symbol" ? t + "" : t, e), e);
|
|
4
|
-
const s = class s {
|
|
5
|
-
};
|
|
6
|
-
m(s, "items", []), m(s, "push", ({ action: t, reject: e }) => {
|
|
7
|
-
s.items.some((o) => o.action === t) || s.items.push({ action: t, reject: e });
|
|
8
|
-
}), m(s, "setResponse", (t) => {
|
|
9
|
-
for (let e = 0; e < s.items.length; e++) {
|
|
10
|
-
const a = s.items[e];
|
|
11
|
-
if (t.action === a.action) {
|
|
12
|
-
a.reject(t.mess);
|
|
13
|
-
break;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
let l = s;
|
|
18
|
-
export {
|
|
19
|
-
l as ProcessingWS
|
|
20
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
var s = Object.defineProperty;
|
|
2
|
-
var r = (n, e, t) => e in n ? s(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
-
var i = (n, e, t) => (r(n, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
-
class h {
|
|
5
|
-
constructor() {
|
|
6
|
-
i(this, "isOnline", window.navigator.onLine);
|
|
7
|
-
i(this, "isWatcher", !1);
|
|
8
|
-
}
|
|
9
|
-
watchIsOffline() {
|
|
10
|
-
this.isOnline = !1;
|
|
11
|
-
}
|
|
12
|
-
watchIsOnline() {
|
|
13
|
-
this.isOnline = !0;
|
|
14
|
-
}
|
|
15
|
-
addWatcherInternet() {
|
|
16
|
-
this.isWatcher || (console.dir("Установка событий (online, offline) InternetWatcher.addWatcherInternet"), this.isWatcher = !0, window.addEventListener("offline", this.watchIsOffline), window.addEventListener("online", this.watchIsOnline));
|
|
17
|
-
}
|
|
18
|
-
removeWatcherInternet() {
|
|
19
|
-
this.isWatcher && (console.dir("Удаление событий (online, offline) InternetWatcher.addWatcherInternet"), window.removeEventListener("offline", this.watchIsOffline), window.removeEventListener("online", this.watchIsOnline), this.isOnline = !1, this.isWatcher = !1);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
export {
|
|
23
|
-
h as InternetWatcher
|
|
24
|
-
};
|