fix types

This commit is contained in:
undefined committed 2024-01-06 13:39:27 +08:00
1 parent 91179ebe66
commit 98c917ed4a
7 files changed
+11 -18

No files matched your search

+7 -6
View File
@@ -1,8 +1,9 @@
/// <reference no-default-lib="true"/>
/// <reference lib="ES2015" />
/// <reference types="@types/serviceworker" />
/* global clients */
/* eslint-disable no-restricted-globals */
/// <reference no-default-lib="true" />
/// <reference lib="webworker" />
export { }; // make it a module so that declare self works
declare const self: ServiceWorkerGlobalScope;
const map = new Map();
function createStream(port) {
@@ -78,11 +79,11 @@ self.addEventListener('notificationclick', (event) => {
console.log('On notification click: ', event.notification.tag);
event.notification.close();
if (!event.notification.tag.startsWith('message-')) return;
event.waitUntil(clients.matchAll({ type: 'window' }).then((clientList) => {
event.waitUntil(self.clients.matchAll({ type: 'window' }).then((clientList) => {
for (const client of clientList) {
if (client.url === '/home/messages' && 'focus' in client) return client.focus();
}
if (clients.openWindow) clients.openWindow('/home/messages');
if (self.clients.openWindow) self.clients.openWindow('/home/messages');
return null;
}));
});