Generic function for toast notification

PHOTO EMBED

Fri Jul 01 2022 14:41:53 GMT+0000 (Coordinated Universal Time)

Saved by @gbritgs #lwc

showNotification(title, msg, variant) {
  const evt = new ShowToastEvent({
    title: title,
    message: msg,
    variant: variant
  })
  this.dispatchEvent(evt);
}

//to use it, call the method passing parameters like "this.showNotification('Title', 'Message', 'success')""
content_copyCOPY