Skip to content

Instantly share code, notes, and snippets.

@romellfudi romellfudi/index.html
Last active Jun 30, 2019

Embed
What would you like to do?
WebAPK APP MANIFEST CHROME HOME SCREEN
...
<link rel="manifest" href="/manifest.json">
</head>
...
<script>
if ('serviceWorker' in navigator) {
console.log("Will the service worker register?");
navigator.serviceWorker.register('service-worker.js')
.then(function(reg){
console.log("Yes, it did.");
}).catch(function(err) {
console.log("No it didn't. This happened: ", err)
});
}
</script>
</body>
{
"short_name": "Romell D.Z.",
"name": "Romell D.Z.'s Portfolio",
"offline_enabled": true,
"icons": [
{
"src":"images/icono.png",
"sizes": "192x192",
"type": "image/png"
}
],
"start_url": "/?utm_source=homescreen",
"background_color": "#FFFFFF",
"theme_color": "#FFFFFF",
"display": "standalone"
}
const CACHE_NAME = 'nova-cache-v1';
self.addEventListener('install', function(e) {
console.log('installing.');
e.waitUntil(
caches.open(CACHE_NAME).then(cache => {
return cache.addAll([
'/',
'/assets/css/style.css?v=924d2ed97c4bfc76afa5902ab363e1b27f9ae710',
'/index_files/codelab-elements.css',
'/index_files/codelab-elements.js',
'/index_files/custom-elements.min.js',
'/index_files/css',
'/index_files/icon',
'/index_files/native-shim.js',
'/index_files/prettify.js',
'/agente_biometrico/',
'/servicio_apiapk/',
'/offline.html'
]);
})
);
});
self.addEventListener('activate', event => {
console.log('actived');
event.waitUntil(self.clients.claim());
});
self.addEventListener('fetch', evt => {
console.log('fething')
if (evt.request.mode !== 'navigate') {
// Not a page navigation, bail.
return;
}
// evt.respondWith(
// fetch(evt.request)
// .catch(() => {
// return caches.open(CACHE_NAME)
// .then((cache) => {
// return cache.match('/offline.html');
// });
// })
// );
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.