gost-next-pwa-notification
v1.0.2
Published
Desktop push notification for react/next js.
Downloads
4
Maintainers
Readme
gost-next-pwa-notification
React/Next js browser push/desktop notification.
Install npm package
npm install gost-next-pwa-notification
import {showNotification, setNotificationCount, clearNotificationCount, askNotificationPermission} from 'gost-next-pwa-notification'
To show notification and ask notification permission
showNotification(title, bodyText, img, silent, sound)
// Example:
// showNotification('My Title', 'This is sample text', '/icon-192x192.png', false, 'default')
// showNotification('My Title', 'This is sample text', '/icon-192x192.png', true, '/notificationSound.wav')
// Detail:
// title - Notification title
// bodyText - Content of notification
// img - image url
// silent - must be a boolean (true or false) make notification silent or with sound
// sound - custom audio url (or) 'default'
Ask user to allow notification alert
askNotificationPermission()
Set App Icon Notification Badge on both mobile and desktop
setNotificationCount(count)
// Example:
// setNotificationCount(5)
Clean App Icon Notification Badge
clearNotificationCount()
Developer Contact gost at [email protected]{P}