<!DOCTYPE html>
<meta charset="utf-8">
<title>register a service worker</title>
<script>
async function setup(script_file_arg, register_opts) {
let script_file = script_file_arg || 'service_worker.js';
let options = register_opts || '{}';
await navigator.serviceWorker.register(script_file, JSON.parse(options));
await navigator.serviceWorker.ready;
return 'ok';
}
function hasController() {
return !!navigator.serviceWorker.controller;
}
</script>