Is it possible to display a warning toast event msg whenever a component is created?
Basically, without triggering it in any way, like with a btn click.
.js
showMsg(){
const evt = new ShowToastEvent({
title: 'Toast Warning',
message: 'Warning!',
variant: 'warning',
mode: 'sticky'
});
this.dispatchEvent(evt);
}
.html
<div class="warning" onnotification={showMsg}></div>
'Cause right now it obviously isn't working.
If not with an event, how can I achieve that? (Trying to avoid custom css)
this.showMsg()
from theconnectedCallback
on your LWC?slds-notify
and get it done get it over with :) Thanks for your time both of you.