Add constructor to display alerts

This commit is contained in:
buzzcode2007 2024-04-08 15:41:35 +08:00
parent fe5437e6d3
commit 20aeb7b75e

View file

@ -21,8 +21,21 @@ export default class alerts {
return user_response; return user_response;
} }
constructor(TITLE, MESSAGE) {
// Set this message's properties.
this.TITLE = TITLE;
this.MESSAGE = MESSAGE;
// Display the message.
console.log(TITLE, MESSAGE);
try {
M.toast({ text: TITLE.concat(`\n`).concat(MESSAGE) });
} catch (err) {}
}
static log(message) { static log(message) {
console.log(message); console.log(message);
try { try {
M.toast({ text: message }); M.toast({ text: message });
} catch (err) {} } catch (err) {}