Skip to content

yohanstesfaye/Notify-Me

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Notify Me

Notify Me

A simple javascript push notification library for a websites. It uses a javascript Notification API and supported on all browsers for desktop and mobile.

Get started

to use a push notification feature you need to add a push notification to your website add

  1. Add/link javascript file from dist folder to your website
  2. make a function call to on notification object using using NotifyMe object.

Request Notification Permission

to get show a push notification for a user need to grant a notification access on the browser. so to do that we need to use the following method to request a notification permission.

NotifyMe.requestPermission();

Get Notification Permission

To check the status of status of website notification permission you can use the following method. It have a return values default, granted or denied

NotifyMe.permission();

Show notification

to make a push notification make a call to member function notify it will have an object argument option which have 3 important properties title, tag, message other more optional properties.

NotifyMe.notify({
    title: "Title",
    tag: "tag",
    message: "Notification body/message",
});

Methods

Method Description
requestPermission() make a request for notification access permission
permission() return notification permission status
notify(option) show notification

Properties

A properties that can be used on Option for notify method

Properties Description Value Default Note
title add titlte to notification string null Important
tag linking morethan one notification together string null Important
message notification body string null Important
icon url address to icon/logo url null
image url address to image url null Not supported by all browsers
silent intended to fire a silent notification boolean false Not supported by all browsers
renotify intended to fire a silent notification boolean true Not supported by all browsers