create_notification.html (613B)
1 <!DOCTYPE html> 2 <html> 3 <head><meta charset=utf-8> 4 <title>Create a notification</title> 5 </head> 6 <body> 7 <script src="NotificationTest.js"></script> 8 <script> 9 // Can't use top level await because of eslint limitation 10 // https://github.com/BenoitZugmeyer/eslint-plugin-html/issues/139 11 (async () => { 12 await NotificationTest.allowNotifications(); 13 14 let swr = await navigator.serviceWorker.register("notification_empty_sw.js"); 15 await navigator.serviceWorker.ready; 16 await swr.showNotification("This is a title", { 17 body: "This is a notification body", 18 tag: "sometag", 19 }); 20 })(); 21 </script> 22 </body> 23 </html>