Molodetz blogrol volgens DPP-template
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
// retoor <retoor@molodetz.nl>
|
||||
export class LoadingButton {
|
||||
static setLoading(button, on) {
|
||||
if (!button) {
|
||||
return;
|
||||
}
|
||||
button.classList.toggle("is-loading", on);
|
||||
button.disabled = on;
|
||||
button.setAttribute("aria-busy", on ? "true" : "false");
|
||||
const existing = button.querySelector(".spinner");
|
||||
if (on && !existing) {
|
||||
const spinner = document.createElement("span");
|
||||
spinner.className = "spinner";
|
||||
spinner.setAttribute("aria-hidden", "true");
|
||||
button.prepend(spinner);
|
||||
} else if (!on && existing) {
|
||||
existing.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user