Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
kaditya97 committed Feb 23, 2021
1 parent af41ba1 commit e39f3e4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="manifest" href="./manifest.webmanifest">
<title>Leaflet Map</title>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"
integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ=="
Expand Down
15 changes: 15 additions & 0 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,3 +408,18 @@ L.easyButton('fa-globe fa-lg', function(){
L.easyButton('fa-info fa-lg', function(){
iframe();
},"Info","topleft").addTo(map);

window.addEventListener('load', () => {
registerSW();
});


async function registerSW() {
if ('serviceWorker' in navigator) {
try {
await navigator.serviceWorker.register('../sw.js');
} catch (e) {
console.log(`SW registration failed`);
}
}
}

0 comments on commit e39f3e4

Please sign in to comment.