mirror of
https://github.com/lus/pasty.git
synced 2023-08-10 21:13:09 +03:00
19 lines
413 B
JavaScript
19 lines
413 B
JavaScript
|
// element holds the spinners DOM element
|
||
|
const element = document.getElementById("spinner");
|
||
|
|
||
|
// show shows the spinner
|
||
|
export function show() {
|
||
|
element.classList.remove("hidden");
|
||
|
}
|
||
|
|
||
|
// hide hides the spinner
|
||
|
export function hide() {
|
||
|
element.classList.add("hidden");
|
||
|
}
|
||
|
|
||
|
// surround surrounds an action with a spinner
|
||
|
export async function surround(action) {
|
||
|
show();
|
||
|
await action();
|
||
|
hide();
|
||
|
}
|