Added final null checks

This commit is contained in:
2019-04-22 15:59:08 +09:00
parent 70a62f06e5
commit 480ba3a370
8 changed files with 145 additions and 93 deletions

View File

@ -36,8 +36,19 @@ export function chargeUp(arn: AnimeNotifier, button: HTMLElement) {
// Toggle fade
export function toggleFade(arn: AnimeNotifier, button: HTMLElement) {
let elementId = button.dataset.elementId
if(!elementId) {
console.error("Missing element ID:", elementId)
return
}
let element = document.getElementById(elementId)
if(!element) {
console.error("Invalid element ID:", elementId)
return
}
if(element.classList.contains("fade-out")) {
element.classList.remove("fade-out")
} else {