From 326c2cf70a5bb67c2a02f5a803d6f22830195bd4 Mon Sep 17 00:00:00 2001 From: Harvey Tindall Date: Fri, 7 May 2021 14:30:30 +0100 Subject: [PATCH] modal: use arrow function to avoid 'this' naming collision --- ts/modules/modal.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ts/modules/modal.ts b/ts/modules/modal.ts index 95be1c1..7bbc071 100644 --- a/ts/modules/modal.ts +++ b/ts/modules/modal.ts @@ -7,9 +7,9 @@ export class Modal implements Modal { closeEvent: CustomEvent; constructor(modal: HTMLElement, important: boolean = false) { this.modal = modal; - this.openEvent = new CustomEvent("modal-open-" + modal.id) - this.closeEvent = new CustomEvent("modal-close-" + modal.id) - const closeButton = this.modal.querySelector('span.modal-close') + this.openEvent = new CustomEvent("modal-open-" + modal.id); + this.closeEvent = new CustomEvent("modal-close-" + modal.id); + const closeButton = this.modal.querySelector('span.modal-close'); if (closeButton !== null) { this.closeButton = closeButton as HTMLSpanElement; this.closeButton.onclick = this.close; @@ -26,7 +26,7 @@ export class Modal implements Modal { } this.modal.classList.add('modal-hiding'); const modal = this.modal; - const listenerFunc = function () { + const listenerFunc = () => { modal.classList.remove('modal-shown'); modal.classList.remove('modal-hiding'); modal.removeEventListener(window.animationEvent, listenerFunc);