From 571dc18f345fd48254d57dd9c20406015c524b23 Mon Sep 17 00:00:00 2001 From: buzz-lightsnack-2007 <73412182+buzz-lightsnack-2007@users.noreply.github.com> Date: Tue, 9 Apr 2024 09:32:38 +0800 Subject: [PATCH] update constructor on message initiing --- gui/scripts/alerts.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/gui/scripts/alerts.js b/gui/scripts/alerts.js index 2f48f6e..5dd8878 100644 --- a/gui/scripts/alerts.js +++ b/gui/scripts/alerts.js @@ -16,13 +16,17 @@ export default class alerts { constructor(TITLE, MESSAGE) { // Set this message's properties. - this.TITLE = TITLE; - this.MESSAGE = MESSAGE; + if (MESSAGE = null) { + this.message = TITLE; + } else { + this.title = TITLE; + this.message = MESSAGE; + } // Display the message. - console.log(TITLE, MESSAGE); + console.log((MESSAGE ? (this.title).concat(`\n`) : ``).concat(this.message)); try { - M.toast({ text: TITLE.concat(`\n`).concat(MESSAGE) }); + M.toast({ text: (MESSAGE ? (this.title).concat(`\n`) : ``).concat(this.message) }); } catch (err) {} }