mirror of
https://github.com/navidrome/navidrome.git
synced 2026-11-23 18:39:46 +01:00
Add Desktop Notifications
This commit is contained in:
parent
b8d47d1db4
commit
2397a7e464
12 changed files with 99 additions and 4 deletions
|
|
@ -1,3 +1,4 @@
|
|||
export * from './baseUrl'
|
||||
export * from './docsUrl'
|
||||
export * from './formatters'
|
||||
export * from './notifications'
|
||||
|
|
|
|||
12
ui/src/utils/notifications.js
Normal file
12
ui/src/utils/notifications.js
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
export const sendNotification = (title, body = '', image = '') => {
|
||||
checkForNotificationPermission()
|
||||
new Notification(title, {
|
||||
body: body,
|
||||
icon: image,
|
||||
silent: true
|
||||
})
|
||||
}
|
||||
|
||||
const checkForNotificationPermission = () => {
|
||||
return 'Notification' in window && Notification.permission === 'granted'
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue