gost-next-pwa-notification

1.0.2 • Public • Published

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 godofsoftwaret@gmail.com--MK-3794-{P}

Package Sidebar

Install

npm i gost-next-pwa-notification

Weekly Downloads

3

Version

1.0.2

License

MIT

Unpacked Size

216 kB

Total Files

4

Last publish

Collaborators

  • gost1