Add working but unstyled notify registration modal

This commit is contained in:
Gabe Kangas
2022-05-29 21:52:38 -07:00
parent bf7319db9a
commit 1684979187
14 changed files with 258 additions and 74 deletions

View File

@@ -1,24 +0,0 @@
self.addEventListener('activate', (event) => {
console.log('Owncast service worker activated', event);
});
self.addEventListener('install', (event) => {
console.log('installing Owncast service worker...', event);
});
self.addEventListener('push', (event) => {
const data = JSON.parse(event.data.text());
const { title, body, icon, tag } = data;
const options = {
title: title || 'Live!',
body: body || 'This live stream has started.',
icon: icon || '/logo/external',
tag: tag,
};
event.waitUntil(self.registration.showNotification(options.title, options));
});
self.addEventListener('notificationclick', (event) => {
clients.openWindow('/');
});