diff options
author | Yamagishi Kazutoshi <ykzts@desire.sh> | 2022-08-26 03:10:01 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-25 20:10:01 +0200 |
commit | 81e1cc5fece9a431c28ca648c2dd4b1b5f643f13 (patch) | |
tree | 0ab25ce1a64ab1f40c726b907fca8f71b86f7774 /app/javascript/mastodon/service_worker/web_push_notifications.js | |
parent | 55bef1e34fc3b07ed7f762d565a161e74e128016 (diff) |
Replace to `workbox-webpack-plugin` from `offline-plugin` (#18409)
Diffstat (limited to 'app/javascript/mastodon/service_worker/web_push_notifications.js')
-rw-r--r-- | app/javascript/mastodon/service_worker/web_push_notifications.js | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/app/javascript/mastodon/service_worker/web_push_notifications.js b/app/javascript/mastodon/service_worker/web_push_notifications.js index 48a2be7e7..9b75e9b9d 100644 --- a/app/javascript/mastodon/service_worker/web_push_notifications.js +++ b/app/javascript/mastodon/service_worker/web_push_notifications.js @@ -75,7 +75,7 @@ const formatMessage = (messageId, locale, values = {}) => const htmlToPlainText = html => unescape(html.replace(/<br\s*\/?>/g, '\n').replace(/<\/p><p>/g, '\n\n').replace(/<[^>]*>/g, '')); -const handlePush = (event) => { +export const handlePush = (event) => { const { access_token, notification_id, preferred_locale, title, body, icon } = event.data.json(); // Placeholder until more information can be loaded @@ -189,7 +189,7 @@ const openUrl = url => return self.clients.openWindow(url); }); -const handleNotificationClick = (event) => { +export const handleNotificationClick = (event) => { const reactToNotificationClick = new Promise((resolve, reject) => { if (event.action) { if (event.action === 'expand') { @@ -211,6 +211,3 @@ const handleNotificationClick = (event) => { event.waitUntil(reactToNotificationClick); }; - -self.addEventListener('push', handlePush); -self.addEventListener('notificationclick', handleNotificationClick); |