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() {
|
||||
if (!("serviceWorker" in navigator)) {
|
||||
throw new Error("No Service Worker support!");
|
||||
if("serviceWorker" in navigator) {
|
||||
navigator.serviceWorker.register("/sw.js");
|
||||
} else {
|
||||
console.log("No Service Worker support!");
|
||||
}
|
||||
navigator.serviceWorker.register("/sw.js");
|
||||
}
|
||||
|
||||
export function requestNotificationPermission() {
|
||||
if (!("PushManager" in window)) {
|
||||
throw new Error("No Push API Support!");
|
||||
if("PushManager" in window) {
|
||||
window.Notification.requestPermission();
|
||||
} else {
|
||||
console.log("No Push API Support!");
|
||||
}
|
||||
window.Notification.requestPermission();
|
||||
}
|
||||
|
||||
export function windowNotificationPermission() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue