mirror of
https://github.com/ManInDark/HabitTrove.git
synced 2026-01-21 06:34:30 +01:00
Added PWA support (#40)
This commit is contained in:
BIN
public/icons/icon.png
Normal file
BIN
public/icons/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.4 KiB |
BIN
public/icons/web-app-manifest-192x192.png
Normal file
BIN
public/icons/web-app-manifest-192x192.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
BIN
public/icons/web-app-manifest-512x512.png
Normal file
BIN
public/icons/web-app-manifest-512x512.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 130 KiB |
BIN
public/sounds/timer-end.wav
Normal file
BIN
public/sounds/timer-end.wav
Normal file
Binary file not shown.
22
public/sw.js
Normal file
22
public/sw.js
Normal file
@@ -0,0 +1,22 @@
|
||||
self.addEventListener('push', function (event) {
|
||||
if (event.data) {
|
||||
const data = event.data.json()
|
||||
const options = {
|
||||
body: data.body,
|
||||
icon: data.icon || '/icon.png',
|
||||
badge: '/badge.png',
|
||||
vibrate: [100, 50, 100],
|
||||
data: {
|
||||
dateOfArrival: Date.now(),
|
||||
primaryKey: '2',
|
||||
},
|
||||
}
|
||||
event.waitUntil(self.registration.showNotification(data.title, options))
|
||||
}
|
||||
})
|
||||
|
||||
self.addEventListener('notificationclick', function (event) {
|
||||
console.log('Notification click received.')
|
||||
event.notification.close()
|
||||
event.waitUntil(clients.openWindow('/'))
|
||||
})
|
||||
Reference in New Issue
Block a user