kui-utils 0.0.13 → 0.0.15
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 +6 -4
- package/cjs/index.js.map +1 -1
- package/index.d.ts +2 -1
- package/index.js +6 -4
- package/index.js.map +1 -1
- package/package.json +1 -1
package/cjs/index.js
CHANGED
|
@@ -2088,13 +2088,14 @@ var KUIUtilsSettings = /** @class */ (function () {
|
|
|
2088
2088
|
}());
|
|
2089
2089
|
var kuiUtilsSettings = new KUIUtilsSettings();
|
|
2090
2090
|
|
|
2091
|
-
var
|
|
2091
|
+
var defaultDelayTime = 600;
|
|
2092
2092
|
var Loader = /** @class */ (function () {
|
|
2093
|
-
function Loader(isLoading) {
|
|
2093
|
+
function Loader(isLoading, delayTime) {
|
|
2094
2094
|
var _this = this;
|
|
2095
2095
|
this.startLoading = function (message, withoutCleanError) {
|
|
2096
2096
|
_this.isLoading = true;
|
|
2097
2097
|
_this.loadingMessage = message;
|
|
2098
|
+
_this.timeBeforeLoading = new Date().getTime();
|
|
2098
2099
|
if (!withoutCleanError)
|
|
2099
2100
|
_this.cleanError();
|
|
2100
2101
|
};
|
|
@@ -2105,13 +2106,13 @@ var Loader = /** @class */ (function () {
|
|
|
2105
2106
|
return null;
|
|
2106
2107
|
}
|
|
2107
2108
|
_this.timeAfterLoading = new Date().getTime();
|
|
2108
|
-
if (_this.timeAfterLoading - _this.timeBeforeLoading < delayTime) {
|
|
2109
|
+
if (_this.timeAfterLoading - _this.timeBeforeLoading < _this.delayTime) {
|
|
2109
2110
|
return new Promise(function (resolve) {
|
|
2110
2111
|
// eslint-disable-next-line no-promise-executor-return
|
|
2111
2112
|
return setTimeout(function () {
|
|
2112
2113
|
_this.isLoading = false;
|
|
2113
2114
|
resolve(true);
|
|
2114
|
-
}, delayTime - (_this.timeAfterLoading - _this.timeBeforeLoading));
|
|
2115
|
+
}, _this.delayTime - (_this.timeAfterLoading - _this.timeBeforeLoading));
|
|
2115
2116
|
});
|
|
2116
2117
|
}
|
|
2117
2118
|
_this.isLoading = false;
|
|
@@ -2130,6 +2131,7 @@ var Loader = /** @class */ (function () {
|
|
|
2130
2131
|
this.hasError = false;
|
|
2131
2132
|
this.timeBeforeLoading = 0;
|
|
2132
2133
|
this.timeAfterLoading = 0;
|
|
2134
|
+
this.delayTime = delayTime || defaultDelayTime;
|
|
2133
2135
|
mobx.makeAutoObservable(this);
|
|
2134
2136
|
}
|
|
2135
2137
|
return Loader;
|