wip
This commit is contained in:
parent
f95ca164d6
commit
77902e8d80
|
@ -1,7 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Language manager for SW
|
* Language manager for SW
|
||||||
*/
|
*/
|
||||||
|
|
||||||
declare var self: ServiceWorkerGlobalScope;
|
declare var self: ServiceWorkerGlobalScope;
|
||||||
|
|
||||||
import { get, set } from 'idb-keyval';
|
import { get, set } from 'idb-keyval';
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
/*
|
/*
|
||||||
* Notification manager for SW
|
* Notification manager for SW
|
||||||
*/
|
*/
|
||||||
|
|
||||||
declare var self: ServiceWorkerGlobalScope;
|
declare var self: ServiceWorkerGlobalScope;
|
||||||
|
|
||||||
import { getNoteSummary } from '../../misc/get-note-summary';
|
import { getNoteSummary } from '../../misc/get-note-summary';
|
||||||
import getUserName from '../../misc/get-user-name';
|
import getUserName from '../../misc/get-user-name';
|
||||||
import { swLang } from '@/sw/lang'
|
import { swLang } from '@/sw/lang';
|
||||||
|
|
||||||
class SwNotification {
|
class SwNotification {
|
||||||
private queue: any[] = [];
|
private queue: any[] = [];
|
||||||
|
@ -22,11 +21,11 @@ class SwNotification {
|
||||||
if (this.fetching == false) {
|
if (this.fetching == false) {
|
||||||
this.fetching = true;
|
this.fetching = true;
|
||||||
await swLang.fetchLocale();
|
await swLang.fetchLocale();
|
||||||
this.fetching = false;
|
|
||||||
const promises = this.queue.map(this.composeNotification).map(n => {
|
const promises = this.queue.map(this.composeNotification).map(n => {
|
||||||
if (!n) return;
|
if (!n) return;
|
||||||
return self.registration.showNotification(...n);
|
return self.registration.showNotification(...n);
|
||||||
})
|
});
|
||||||
|
this.fetching = false;
|
||||||
this.queue = [];
|
this.queue = [];
|
||||||
return Promise.all(promises);
|
return Promise.all(promises);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue