working towards a PWA
This commit is contained in:
@@ -3,3 +3,16 @@ import { Elm } from "./elm/Main.elm";
|
||||
Elm.Main.init(
|
||||
{ node: document.getElementById("root") }
|
||||
);
|
||||
|
||||
if ('serviceWorker' in navigator) {
|
||||
window.addEventListener('load', function() {
|
||||
navigator.serviceWorker.register(new URL('./sw.js', import.meta.url)).then(function(registration) {
|
||||
// Registration was successful
|
||||
console.log('ServiceWorker registration successful with scope: ', registration.scope);
|
||||
}, function(err) {
|
||||
// registration failed :(
|
||||
console.log('ServiceWorker registration failed: ', err);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user