aboutsummaryrefslogtreecommitdiff
path: root/src/main/resources/static/sw.js
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2023-05-31 06:10:51 +0300
committerGravatar Vitaly Takmazov2023-05-31 06:11:05 +0300
commitf2a7ea3af919548d41383734e8a3667086a44bcc (patch)
treee0d9db07956f10ccc4e27fc9e0d45d88950dbfbb /src/main/resources/static/sw.js
parent395185d093b2d6bb46d02830088e00a3a2ca20c1 (diff)
eslint: enforce semicolons only before statement continuation chars
Diffstat (limited to 'src/main/resources/static/sw.js')
-rw-r--r--src/main/resources/static/sw.js34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/main/resources/static/sw.js b/src/main/resources/static/sw.js
index 0520bcc1..a64de7cc 100644
--- a/src/main/resources/static/sw.js
+++ b/src/main/resources/static/sw.js
@@ -2,46 +2,46 @@
/// <reference lib="esnext" />
/// <reference lib="WebWorker" />
-var sw = /** @type {ServiceWorkerGlobalScope & typeof self} */ (self);
+var sw = /** @type {ServiceWorkerGlobalScope & typeof self} */ (self)
sw.addEventListener('install', function() {
- sw.skipWaiting();
-});
+ sw.skipWaiting()
+})
sw.addEventListener('activate', function() {
- sw.clients.claim();
-});
+ sw.clients.claim()
+})
sw.addEventListener('push', function(evt) {
if (evt.data) {
- const data = evt.data.json();
- console.log('Push', data);
+ const data = evt.data.json()
+ console.log('Push', data)
if (data.body) {
sw.registration.showNotification(data.title, {
body: data.body,
icon: data.custom.message.user.avatar,
tag: data.tag,
data: data.custom.message
- });
+ })
}
}
-});
+})
sw.addEventListener('notificationclick', function(evt) {
evt.waitUntil(
sw.clients.matchAll().then(function(clientList) {
- const message = evt.notification.data;
+ const message = evt.notification.data
const url = message.mid
? message.rid
? `https://juick.com/m/${message.mid}#${message.rid}`
: `https://juick.com/m/${message.mid}`
- : 'https://juick.com/pm/inbox';
+ : 'https://juick.com/pm/inbox'
if (clientList.length > 0) {
for (var i = 0; i < clientList.length; i++) {
if (clientList[i].url === url) {
- return clientList[i].focus();
+ return clientList[i].focus()
}
}
- clientList[0].navigate(url);
- return clientList[0].focus();
+ clientList[0].navigate(url)
+ return clientList[0].focus()
}
- return sw.clients.openWindow(url);
+ return sw.clients.openWindow(url)
})
- );
-});
+ )
+})