self.__precacheManifest = [].concat(self.__precacheManifest || []);

// workbox.setConfig({
//     debug: true
// });

workbox.precaching.precacheAndRoute(self.__precacheManifest, {});

self.addEventListener("push", function (event) {
    console.log('Received a push message', event);
    if (event.data) {
        var data = event.data.json();
        console.log(data);
        event.waitUntil(self.registration.showNotification(data.notification.title, {
            body: data.notification.body,
            icon: data.notification.image || null
        }));
    }
});

self.addEventListener("notificationclick", function (event) {
    const promiseChain = clients.openWindow("https://gabenparadise.com/");
    event.waitUntil(promiseChain);
});
