2023-09-03 11:39:13 +03:00
|
|
|
'use strict';
|
|
|
|
|
2023-08-16 16:02:20 +03:00
|
|
|
const container = document.querySelector('.container');
|
|
|
|
const coffees = [
|
|
|
|
{ name: 'Tony Stark', image: 'images/Tony_Stark.jpg' },
|
|
|
|
{ name: 'DeusEx', image: 'images/DeusEx.png' },
|
|
|
|
{ name: 'Face', image: 'images/Face.png' },
|
|
|
|
{ name: 'Bear', image: 'images/Bear.png' },
|
|
|
|
];
|
|
|
|
const showCoffees = () => {
|
|
|
|
let output = '';
|
|
|
|
coffees.forEach(
|
|
|
|
({ name, image }) =>
|
|
|
|
(output += `
|
|
|
|
<div class="card">
|
|
|
|
<img class="card--avatar" src=${image} />
|
2023-09-03 11:39:13 +03:00
|
|
|
<p class="card--title">${name}</p>
|
2023-08-16 16:02:20 +03:00
|
|
|
</div>
|
|
|
|
`),
|
|
|
|
);
|
|
|
|
container.innerHTML = output;
|
|
|
|
};
|
|
|
|
|
|
|
|
document.addEventListener('DOMContentLoaded', showCoffees);
|
2023-09-03 11:39:13 +03:00
|
|
|
|
|
|
|
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));
|
|
|
|
});
|
|
|
|
}
|