Skip to content

Commit

Permalink
test: beforeinstallprompt in index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
brunocassol committed Sep 19, 2023
1 parent 82b1a6e commit 14f3535
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
9 changes: 8 additions & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,15 @@
<script>
// Registering Service Worker
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/sw.js');
navigator.serviceWorker.register('/sw.js');
}

let deferredPrompt;

window.addEventListener('beforeinstallprompt', (e) => {
deferredPrompt = e;
console.log('beforeinstallprompt', e);
});
</script>
</head>
<body>
Expand Down
7 changes: 0 additions & 7 deletions docs/sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,4 @@ self.addEventListener('install', (e) => {
e.respondWith(
caches.match(e.request).then((response) => response || fetch(e.request)),
);
});

let deferredPrompt;

window.addEventListener('beforeinstallprompt', (e) => {
deferredPrompt = e;
console.log('beforeinstallprompt', e);
});

0 comments on commit 14f3535

Please sign in to comment.