code cleanup
This commit is contained in:
parent
13ef686e36
commit
1e21cc31c4
1 changed files with 8 additions and 6 deletions
|
|
@ -1,15 +1,17 @@
|
||||||
export function registerServiceWorker() {
|
export function registerServiceWorker() {
|
||||||
if (!("serviceWorker" in navigator)) {
|
if("serviceWorker" in navigator) {
|
||||||
throw new Error("No Service Worker support!");
|
navigator.serviceWorker.register("/sw.js");
|
||||||
|
} else {
|
||||||
|
console.log("No Service Worker support!");
|
||||||
}
|
}
|
||||||
navigator.serviceWorker.register("/sw.js");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function requestNotificationPermission() {
|
export function requestNotificationPermission() {
|
||||||
if (!("PushManager" in window)) {
|
if("PushManager" in window) {
|
||||||
throw new Error("No Push API Support!");
|
window.Notification.requestPermission();
|
||||||
|
} else {
|
||||||
|
console.log("No Push API Support!");
|
||||||
}
|
}
|
||||||
window.Notification.requestPermission();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function windowNotificationPermission() {
|
export function windowNotificationPermission() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue