Shared: Components: TopLoadingIndicator: Added cancel method for cancellation current loading process

This commit is contained in:
Ilya Oleshko 2024-08-01 14:05:51 +03:00
parent a453b1e8b4
commit a1d4ad5e34

View File

@ -37,12 +37,16 @@ let elem =
typeof document !== "undefined" &&
document.getElementById("ipl-progress-indicator");
const cancelProgress = () => {
if (timerId) clearTimeout(timerId);
timerId = null;
if (elem) elem.style.width = "0px";
width = 0;
};
const animatingWidth = () => {
if (width >= MAX) {
if (timerId) clearTimeout(timerId);
timerId = null;
if (elem) elem.style.width = "0px";
width = 0;
cancelProgress();
return;
}
@ -64,6 +68,10 @@ export default class TopLoaderService {
startInterval();
}
static cancel() {
cancelProgress();
}
static end() {
percentage = MAX;
}