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) {
// 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) {}
}