View sw-registration.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ('serviceWorker' in navigator && location.hostname !== "localhost") { | |
window.addEventListener('load', function() { | |
navigator.serviceWorker.register(‚service-worker.js’).then(function(reg) { | |
// updatefound is fired if service-worker.js changes. | |
reg.onupdatefound = function() { | |
var installingWorker = reg.installing; | |
installingWorker.onstatechange = function() { | |
switch (installingWorker.state) { | |
case 'installed': |
View sw-toolbox-config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
runtimeCaching: [{ | |
urlPattern: /api\.feedgist\.io/, | |
handler: 'networkFirst' | |
}, { | |
urlPattern: /.fbcdn\.net/, | |
handler: 'cacheFirst' | |
}, { | |
urlPattern: /akamaihd\.net/, | |
handler: 'cacheFirst' | |
}, { |
View import-sw.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
importScripts('service-worker.js'); // our Service Worker generated by sw-precache | |
importScripts('https://cdn.onesignal.com/sdks/OneSignalSDK.js'); // OneSignal’s Service Worker |
View .htaccess
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<FilesMatch "^(OneSignalSDKWorker.*|service-worker.*|OneSignalSDKUpdaterWorker.*)\.(js)$"> | |
FileETag None | |
<ifModule mod_headers.c> | |
Header unset ETag | |
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate" | |
Header set Pragma "no-cache" | |
Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT" | |
</ifModule> | |
</FilesMatch> |