update PWA
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
const container = document.querySelector('.container');
|
||||
const coffees = [
|
||||
{ name: 'Tony Stark', image: 'images/Tony_Stark.jpg' },
|
||||
@@ -12,8 +14,7 @@ const showCoffees = () => {
|
||||
(output += `
|
||||
<div class="card">
|
||||
<img class="card--avatar" src=${image} />
|
||||
<h1 class="card--title">${name}</h1>
|
||||
<a class="card--link" href="#">[CLICK]</a>
|
||||
<p class="card--title">${name}</p>
|
||||
</div>
|
||||
`),
|
||||
);
|
||||
@@ -21,3 +22,12 @@ const showCoffees = () => {
|
||||
};
|
||||
|
||||
document.addEventListener('DOMContentLoaded', showCoffees);
|
||||
|
||||
if ('serviceWorker' in navigator) {
|
||||
window.addEventListener('load', function () {
|
||||
navigator.serviceWorker
|
||||
.register('/sw.js', { scope: '/' })
|
||||
.then((res) => console.log('Service worker registered'))
|
||||
.catch((err) => console.log('Service worker not registered', err));
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user