debug.html (614B)
1 <!-- Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ --> 3 4 <!DOCTYPE HTML> 5 <html> 6 <head> 7 <meta charset="UTF-8"> 8 <title>Service worker test</title> 9 </head> 10 <body> 11 <script type="text/javascript"> 12 "use strict"; 13 window.sw = navigator.serviceWorker.register("debug-sw.js"); 14 15 /* exported fetchFromWorker */ 16 async function fetchFromWorker() { 17 const response = await fetch("test"); 18 const text = await response.text(); 19 console.log(`Response from worker: ${text}`); 20 } 21 </script> 22 23 <p>This page has a <code>fetchFromWorker()</code> function.</p> 24 </body> 25 </html>