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