Skip to content

Commit

Permalink
service worker added
Browse files Browse the repository at this point in the history
  • Loading branch information
KudahShambare committed Jun 26, 2023
1 parent 5672947 commit 0d62bda
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 11 deletions.
15 changes: 15 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,21 @@
<link rel="icon" type="image/jpeg" href="./Burger.jpeg">
<title>Daggie</title>

<!-- Add the following script tag to register the service worker -->
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('load', function() {
navigator.serviceWorker.register('./sw.js')
.then(function(registration) {
console.log('Service Worker registered with scope:', registration.scope);
})
.catch(function(error) {
console.error('Service Worker registration failed:', error);
});
});
}
</script>


<script type="text/javascript">
(function(c,l,a,r,i,t,y){
Expand Down
2 changes: 1 addition & 1 deletion script.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ const stopGame = () => {
*/
/*Save userdata into a cookie*/
if(userName== "" || null){
if(userName== "" || userName == null){
userName = "Stranger101"
}

Expand Down
2 changes: 2 additions & 0 deletions sw.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions sw.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0d62bda

Please sign in to comment.