update constructor on message initiing

This commit is contained in:
buzz-lightsnack-2007 2024-04-09 09:32:38 +08:00
parent 086ca5a8aa
commit 571dc18f34

View file

@ -16,13 +16,17 @@ export default class alerts {
constructor(TITLE, MESSAGE) { constructor(TITLE, MESSAGE) {
// Set this message's properties. // Set this message's properties.
this.TITLE = TITLE; if (MESSAGE = null) {
this.MESSAGE = MESSAGE; this.message = TITLE;
} else {
this.title = TITLE;
this.message = MESSAGE;
}
// Display the message. // Display the message.
console.log(TITLE, MESSAGE); console.log((MESSAGE ? (this.title).concat(`\n`) : ``).concat(this.message));
try { try {
M.toast({ text: TITLE.concat(`\n`).concat(MESSAGE) }); M.toast({ text: (MESSAGE ? (this.title).concat(`\n`) : ``).concat(this.message) });
} catch (err) {} } catch (err) {}
} }