This repository has been archived on 2022-09-16. You can view files and clone it, but cannot push or open issues/pull-requests.
tlaternet-templates/src/lib/js/index.ts

33 lines
894 B
TypeScript
Raw Normal View History

2022-08-01 16:35:28 +01:00
document.addEventListener("DOMContentLoaded", () => {
2022-08-03 01:48:06 +01:00
const flashButtons = document.querySelectorAll(".notification .delete");
2022-08-01 16:35:28 +01:00
flashButtons.forEach((button) => {
2022-08-03 01:48:06 +01:00
const flash = button.parentNode;
2022-08-01 16:35:28 +01:00
if (flash == null) {
console.error(
"Unreachable because our `querySelector` includes a parent; something went very wrong"
);
return;
}
flash.addEventListener("click", () => {
if (flash == null) {
console.error("Completely unreachable.");
return;
}
if (flash.parentNode == null) {
console.error(
"Notification not placed in DOM; something went very wrong"
);
return;
}
flash.parentNode.removeChild(flash);
});
});
});
2022-08-01 22:07:15 +01:00
export {};