PageSourceSearch

https://imaginalapp.space/push-sw.js

js imaginalapp.space collected 2026-09-29 22:06:47 UTC 887 bytes, 24 lines download raw bytes

1// Web Push handlers, imported into the generated service worker (see vite.config.ts
2// workbox.importScripts). Shows the daily reminder and focuses the app on tap.
3
4self.addEventListener('push', (event) => {
5  let data = {}
6  try { data = event.data ? event.data.json() : {} } catch { /* non-JSON payload */ }
7  event.waitUntil(self.registration.showNotification(data.title || 'Imaginal', {
8    body: data.body || 'A moment for your practice. 🪷',
9    icon: '/icon.svg',
10    badge: '/icon.svg',
11    tag: 'imaginal-daily',
12    data: { url: '/' },
13  }))
14})
15
16self.addEventListener('notificationclick', (event) => {
17  event.notification.close()
18  event.waitUntil(self.clients.matchAll({ type: 'window', includeUncontrolled: true }).then((list) => {
19    for (const client of list) {
20      if ('focus' in client) return client.focus()
21    }
22    return self.clients.openWindow('/')
23  }))
24})

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.