Skip to content

Latest commit

 

History

History
47 lines (41 loc) · 1.51 KB

README.md

File metadata and controls

47 lines (41 loc) · 1.51 KB

NotifyJS

NotifyJS makes desktop notifications easier and ready to use with customization and allows interaction with the notifactions.

How to use

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.

Title, Body, and icon

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 icon

Extras

Here 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)

Events

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 showing

Executing the notifications

To execute the function, you will have to push it by writting this

notify.push();//Executes the notification