Changeset 31e63d1 in Klonkt for src/server.js
- Timestamp:
- 08/07/2026 10:15:44 AM (5 weeks ago)
- Branches:
- main
- Children:
- f889429
- Parents:
- 44c9f3f
- git-author:
- Robin <roboburr@…> (08/07/2026 10:15:42 AM)
- git-committer:
- roboburr <roboburr@…> (08/07/2026 10:15:44 AM)
- File:
-
- 1 edited
-
src/server.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/server.js
r44c9f3f r31e63d1 546 546 try { d = e.data ? e.data.json() : {}; } catch (err) { /* non-JSON push */ } 547 547 const title = d.title || 'Klonkt'; 548 e.waitUntil(self.registration.showNotification(title, { 549 body: d.body || '', 550 icon: '/favicon.svg', 551 badge: '/favicon.svg', 552 tag: d.type ? ('klonkt-' + d.type) : undefined, // collapse same-type bursts 553 data: { url: d.url || '/' }, 554 })); 548 e.waitUntil(Promise.all([ 549 self.registration.showNotification(title, { 550 body: d.body || '', 551 icon: '/favicon.svg', 552 badge: '/favicon.svg', 553 tag: d.type ? ('klonkt-' + d.type) : undefined, // collapse same-type bursts 554 data: { url: d.url || '/' }, 555 }), 556 // Wek ook een pagina die al openstaat. De push IS het teken dat er iets 557 // veranderd is, dus een aparte live-verbinding ernaast zou hetzelfde nog 558 // eens doen -- en die tweede zou alleen werken zolang de app open is, 559 // terwijl dit kanaal er ook is als hij dicht is. Een kanaal, twee doelen. 560 self.clients.matchAll({ type: 'window', includeUncontrolled: true }) 561 .then(list => { for (const c of list) c.postMessage({ klonkt: 'push', type: d.type || null }); }) 562 .catch(() => { /* geen open venster: niets te wekken */ }), 563 ])); 555 564 }); 556 565 self.addEventListener('notificationclick', e => {
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)