From d19112453514a96a2216c3d3a9fa03001e144cf8 Mon Sep 17 00:00:00 2001 From: firelemons Date: Fri, 29 Sep 2023 20:48:34 -0500 Subject: [PATCH] filled in settext and gettext for notification class --- app/javascript/src/notifier.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/javascript/src/notifier.js b/app/javascript/src/notifier.js index f9c6efe3e3..663e785610 100644 --- a/app/javascript/src/notifier.js +++ b/app/javascript/src/notifier.js @@ -13,7 +13,7 @@ class Notification { } getText () { - + return this.notificationElement.children('span').text() } isDismissable () { @@ -28,8 +28,9 @@ class Notification { } - setText () { - + setText (newText) { + TypeChecker.checkString(newText, 'newText') + return this.notificationElement.children('span').text(newText) } toggleDismissable () { @@ -91,7 +92,7 @@ class Notifier { } const dismissButtonAsHTML = isDismissable ? `` : '' - const newNotification = + const newNotificationAsJQuery = $( `
${escapedMessage} @@ -99,14 +100,15 @@ class Notifier {
` ) - this.notificationsElement.append(newNotification) + this.notificationsElement.append(newNotificationAsJQuery) if (isDismissable) { - newNotification.children('button').on('click', function () { + newNotificationAsJQuery.children('button').on('click', function () { $(this).parent().remove() }) } + const newNotification = new Notification(newNotificationAsJQuery) console.log(newNotification) return newNotification }