NotifyJS makes desktop notifications easier and ready to use with customization and allows interaction with the notifactions.
Create a variable that will allow you to set up a notification
let notify = new NotifyJS();
if(notify.requestPermission()){//Request for users acceptence/rejection
//successful request
}else{
//Unsuccessful request
}
//Use "notify.getPermission()" to return the permission status.To do this you would have to declare a function that will setup your title, body, and icon
notify.setTitle(title='NotifyJS');//Sets a title
notify.setBody(txt='');//Sets the body
notify.setIcon(path='');//Sets the iconHere are some extra options you can do as well
notify.setSilence(set=false);//Silences the notification
notify.setVibrate(set=false);//Vibrates the notification
notify.setLang(lang='en-US');//Changes the notification language
notify.setCloseTime(time=3);//Closing time for the notification(3 seconds)Here are some events you can use for the notifications as well
notify.click(func);//Runs a function when the notification is clicked
notify.closed(func);//Runs a function when the notification is closed
notify.error(func);//Runs a function when the notification has an error
notify.showed(func);//Runs a function when the notification is showingTo execute the function, you will have to push it by writting this
notify.push();//Executes the notification