Notify from the installed web app when a generation finishes.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Towsty
2026-09-01 07:11:12 -05:00
co-authored by Cursor
parent fa32fb0a8e
commit 2635b8838c
7 changed files with 195 additions and 2 deletions
+18
View File
@@ -0,0 +1,18 @@
self.addEventListener('install', (event) => {
event.waitUntil(self.skipWaiting())
})
self.addEventListener('activate', (event) => {
event.waitUntil(self.clients.claim())
})
self.addEventListener('notificationclick', (event) => {
event.notification.close()
event.waitUntil((async () => {
const windows = await self.clients.matchAll({ type: 'window', includeUncontrolled: true })
for (const client of windows) {
if ('focus' in client) return client.focus()
}
if (self.clients.openWindow) return self.clients.openWindow('/')
})())
})