feat: add plugin hooks for compose, attachments, search, lifecycle, and routing
This commit is contained in:
@@ -122,6 +122,7 @@ async function handlePush(event) {
|
||||
|
||||
async function handleNotificationClick(event) {
|
||||
const data = event.notification.data || {};
|
||||
const tag = event.notification.tag || "";
|
||||
const targetUrl = buildClickUrl(data);
|
||||
|
||||
const allClients = await self.clients.matchAll({
|
||||
@@ -129,6 +130,15 @@ async function handleNotificationClick(event) {
|
||||
includeUncontrolled: true,
|
||||
});
|
||||
|
||||
// Notify any in-app clients so plugins listening on toastHooks.onNotificationClick fire.
|
||||
for (const client of allClients) {
|
||||
try {
|
||||
client.postMessage({ kind: "notificationclick", tag, data });
|
||||
} catch (_) {
|
||||
// Closed or detached client - ignore.
|
||||
}
|
||||
}
|
||||
|
||||
for (const client of allClients) {
|
||||
// Reuse an existing tab whenever possible - users on desktop browsers
|
||||
// get annoyed when each notification opens a fresh window.
|
||||
|
||||
Reference in New Issue
Block a user