Skip to content

Commit 340de34

Browse files
authored
Merge pull request #449 from deisterhold/patch-1
Refactor showBusy method for loader class handling
2 parents 474eeee + 55aa2dd commit 340de34

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

js/workflows/workflow.js

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -150,19 +150,23 @@ class Workflow {
150150
}
151151

152152
async showBusy(functionPromise, darkBackground = true) {
153-
if (this.loader) {
154-
if (darkBackground) {
155-
this.loader.classList.add("overlay");
156-
} else {
157-
this.loader.classList.remove("overlay");
153+
try {
154+
if (this.loader) {
155+
if (darkBackground) {
156+
this.loader.classList.add("overlay");
157+
} else {
158+
this.loader.classList.remove("overlay");
159+
}
160+
this.loader.classList.add("busy");
161+
}
162+
let result = await functionPromise;
163+
164+
return result;
165+
} finally {
166+
if (this.loader) {
167+
this.loader.classList.remove("busy");
158168
}
159-
this.loader.classList.add("busy");
160-
}
161-
let result = await functionPromise;
162-
if (this.loader) {
163-
this.loader.classList.remove("busy");
164169
}
165-
return result;
166170
}
167171

168172
async parseParams(urlParams) {

0 commit comments

Comments
 (0)