Shared: Components: TopLoadingIndicator: Added cancel method for cancellation current loading process
This commit is contained in:
parent
a453b1e8b4
commit
a1d4ad5e34
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user