This commit is contained in:
tamaina 2022-01-25 13:30:00 +00:00
parent 7b0bc962c9
commit a9025e7c59

View file

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