fix: more logging
This commit is contained in:
parent
6c0ea00709
commit
f8cf8620b4
@ -1,13 +1,17 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
|
|
||||||
|
let username = 'user1';
|
||||||
|
|
||||||
//OnMount
|
//OnMount
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
console.log('Hello World!');
|
console.log('Hello World!');
|
||||||
|
|
||||||
//Request notification permission
|
//Request notification permission
|
||||||
if ('Notification' in window) {
|
if ('Notification' in window) {
|
||||||
|
alert("I'm about to request notification permissions");
|
||||||
Notification.requestPermission();
|
Notification.requestPermission();
|
||||||
|
alert("Should've just seen a notification request popup");
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
new Notification('Hello World!');
|
new Notification('Hello World!');
|
||||||
}, 5000);
|
}, 5000);
|
||||||
@ -17,11 +21,13 @@
|
|||||||
console.log('registering service worker...');
|
console.log('registering service worker...');
|
||||||
navigator.serviceWorker.getRegistrations().then((registrations) => {
|
navigator.serviceWorker.getRegistrations().then((registrations) => {
|
||||||
for (let registration of registrations) {
|
for (let registration of registrations) {
|
||||||
|
console.log('unregistering service worker...', registration);
|
||||||
registration.unregister();
|
registration.unregister();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
navigator.serviceWorker.register('src/sw.js');
|
navigator.serviceWorker.register('src/sw.js');
|
||||||
} else {
|
} else {
|
||||||
|
alert('Unable to request notification permissions');
|
||||||
console.log('service worker not supported');
|
console.log('service worker not supported');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user