kui-utils 0.0.12 → 0.0.14
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/cjs/index.js +5 -4
- package/cjs/index.js.map +1 -1
- package/index.d.ts +4 -3
- package/index.js +5 -4
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -69,9 +69,10 @@ declare class Loader {
|
|
|
69
69
|
hasError: boolean;
|
|
70
70
|
loadingMessage?: string;
|
|
71
71
|
errorMessage?: string;
|
|
72
|
+
delayTime: number;
|
|
72
73
|
private timeBeforeLoading;
|
|
73
74
|
private timeAfterLoading;
|
|
74
|
-
constructor(isLoading?: boolean);
|
|
75
|
+
constructor(isLoading?: boolean, delayTime?: number);
|
|
75
76
|
startLoading: (message?: string | undefined, withoutCleanError?: boolean | undefined) => void;
|
|
76
77
|
endLoading: () => Promise<unknown> | null;
|
|
77
78
|
setError: (errorMessage?: string | undefined, err?: any) => void;
|
|
@@ -189,7 +190,7 @@ declare const _default: ({
|
|
|
189
190
|
})[];
|
|
190
191
|
|
|
191
192
|
declare type KUIUtilsSettingsParams = {
|
|
192
|
-
runMode?: "
|
|
193
|
+
runMode?: "production" | "development" | "test";
|
|
193
194
|
};
|
|
194
195
|
declare type KUICrmObserver = (settings: KUIUtilsSettingsParams) => void;
|
|
195
196
|
declare class KUIUtilsSettings {
|
|
@@ -198,7 +199,7 @@ declare class KUIUtilsSettings {
|
|
|
198
199
|
id: number;
|
|
199
200
|
constructor();
|
|
200
201
|
getSettings: () => {
|
|
201
|
-
runMode?: "
|
|
202
|
+
runMode?: "production" | "development" | "test" | undefined;
|
|
202
203
|
};
|
|
203
204
|
setSettings: (newSettings: KUIUtilsSettingsParams) => void;
|
|
204
205
|
subscribeToSettings: (observer: KUICrmObserver) => void;
|
package/index.js
CHANGED
|
@@ -2062,9 +2062,9 @@ var KUIUtilsSettings = /** @class */ (function () {
|
|
|
2062
2062
|
}());
|
|
2063
2063
|
var kuiUtilsSettings = new KUIUtilsSettings();
|
|
2064
2064
|
|
|
2065
|
-
var
|
|
2065
|
+
var defaultDelayTime = 600;
|
|
2066
2066
|
var Loader = /** @class */ (function () {
|
|
2067
|
-
function Loader(isLoading) {
|
|
2067
|
+
function Loader(isLoading, delayTime) {
|
|
2068
2068
|
var _this = this;
|
|
2069
2069
|
this.startLoading = function (message, withoutCleanError) {
|
|
2070
2070
|
_this.isLoading = true;
|
|
@@ -2079,13 +2079,13 @@ var Loader = /** @class */ (function () {
|
|
|
2079
2079
|
return null;
|
|
2080
2080
|
}
|
|
2081
2081
|
_this.timeAfterLoading = new Date().getTime();
|
|
2082
|
-
if (_this.timeAfterLoading - _this.timeBeforeLoading < delayTime) {
|
|
2082
|
+
if (_this.timeAfterLoading - _this.timeBeforeLoading < _this.delayTime) {
|
|
2083
2083
|
return new Promise(function (resolve) {
|
|
2084
2084
|
// eslint-disable-next-line no-promise-executor-return
|
|
2085
2085
|
return setTimeout(function () {
|
|
2086
2086
|
_this.isLoading = false;
|
|
2087
2087
|
resolve(true);
|
|
2088
|
-
}, delayTime - (_this.timeAfterLoading - _this.timeBeforeLoading));
|
|
2088
|
+
}, _this.delayTime - (_this.timeAfterLoading - _this.timeBeforeLoading));
|
|
2089
2089
|
});
|
|
2090
2090
|
}
|
|
2091
2091
|
_this.isLoading = false;
|
|
@@ -2104,6 +2104,7 @@ var Loader = /** @class */ (function () {
|
|
|
2104
2104
|
this.hasError = false;
|
|
2105
2105
|
this.timeBeforeLoading = 0;
|
|
2106
2106
|
this.timeAfterLoading = 0;
|
|
2107
|
+
this.delayTime = delayTime || defaultDelayTime;
|
|
2107
2108
|
makeAutoObservable(this);
|
|
2108
2109
|
}
|
|
2109
2110
|
return Loader;
|