diff options
Diffstat (limited to 'packages/sw/src/scripts')
| -rw-r--r-- | packages/sw/src/scripts/create-notification.ts | 8 | ||||
| -rw-r--r-- | packages/sw/src/scripts/operations.ts | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/packages/sw/src/scripts/create-notification.ts b/packages/sw/src/scripts/create-notification.ts index c121b30bef..e45c3f504c 100644 --- a/packages/sw/src/scripts/create-notification.ts +++ b/packages/sw/src/scripts/create-notification.ts @@ -23,7 +23,7 @@ export async function createNotification<K extends keyof pushNotificationDataMap const n = await composeNotification(data); if (n) { - return self.registration.showNotification(...n); + return globalThis.registration.showNotification(...n); } else { console.error('Could not compose notification', data); return createEmptyNotification(); @@ -239,7 +239,7 @@ export async function createEmptyNotification() { const i18n = await swLang.i18n as I18n<any>; const { t } = i18n; - await self.registration.showNotification( + await globalThis.registration.showNotification( t('_notification.emptyPushNotificationMessage'), { silent: true, @@ -253,8 +253,8 @@ export async function createEmptyNotification() { setTimeout(async () => { for (const n of [ - ...(await self.registration.getNotifications({ tag: 'user_visible_auto_notification' })), - ...(await self.registration.getNotifications({ tag: 'read_notification' })), + ...(await globalThis.registration.getNotifications({ tag: 'user_visible_auto_notification' })), + ...(await globalThis.registration.getNotifications({ tag: 'read_notification' })), ] ) { n.close(); diff --git a/packages/sw/src/scripts/operations.ts b/packages/sw/src/scripts/operations.ts index 4d693223b2..8936a7763a 100644 --- a/packages/sw/src/scripts/operations.ts +++ b/packages/sw/src/scripts/operations.ts @@ -51,11 +51,11 @@ export async function openClient(order: swMessageOrderType, url: string, loginId return client; } - return self.clients.openWindow(getUrlWithLoginId(url, loginId)); + return globalThis.clients.openWindow(getUrlWithLoginId(url, loginId)); } export async function findClient() { - const clients = await self.clients.matchAll({ + const clients = await globalThis.clients.matchAll({ type: 'window', }); for (const c of clients) { |