This commit is contained in:
tamaina 2022-01-25 13:30:00 +00:00
parent 7b0bc962c9
commit a9025e7c59
1 changed files with 13 additions and 12 deletions

View File

@ -202,19 +202,21 @@ async function composeNotification<K extends keyof pushNotificationDataMap>(data
} }
export async function createEmptyNotification() { export async function createEmptyNotification() {
if (!swLang.i18n) swLang.fetchLocale(); return new Promise<void>(async res => {
const i18n = await swLang.i18n as I18n<any>; if (!swLang.i18n) swLang.fetchLocale();
const { t } = i18n; const i18n = await swLang.i18n as I18n<any>;
const { t } = i18n;
await self.registration.showNotification( await self.registration.showNotification(
t('_notification.emptyPushNotificationMessage'), t('_notification.emptyPushNotificationMessage'),
{ {
silent: true, silent: true,
tag: 'read_notification', tag: 'read_notification',
} }
); );
res();
return new Promise<void>(res => {
setTimeout(async () => { setTimeout(async () => {
for (const n of for (const n of
[ [
@ -224,7 +226,6 @@ export async function createEmptyNotification() {
) { ) {
n.close(); n.close();
} }
res();
}, 1000); }, 1000);
}); });
} }