2023-10-01 14:31:00 +03:00
|
|
|
export function registerServiceWorker() {
|
2023-10-01 22:38:11 +03:00
|
|
|
if("serviceWorker" in navigator) {
|
|
|
|
|
navigator.serviceWorker.register("/sw.js");
|
|
|
|
|
} else {
|
|
|
|
|
console.log("No Service Worker support!");
|
2023-07-17 15:00:40 +03:00
|
|
|
}
|
2023-10-01 14:31:00 +03:00
|
|
|
}
|
|
|
|
|
|
2023-12-07 20:53:24 +02:00
|
|
|
export async function requestNotificationPermission() {
|
2023-10-01 22:38:11 +03:00
|
|
|
if("PushManager" in window) {
|
2023-12-07 20:53:24 +02:00
|
|
|
return Notification?.requestPermission().then((permission) => permission);
|
2023-10-01 22:38:11 +03:00
|
|
|
} else {
|
|
|
|
|
console.log("No Push API Support!");
|
2023-07-17 15:00:40 +03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function windowNotificationPermission() {
|
2023-12-07 20:53:24 +02:00
|
|
|
return window?.Notification?.permission ?? 'Not_supported'
|
2023-07-17 15:00:40 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function notificationCount() {
|
|
|
|
|
return this.$matrix.notificationCount
|
|
|
|
|
}
|