Skip to content

Instantly share code, notes, and snippets.

@flushpot1125
Created September 21, 2019 06:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flushpot1125/3c1ca27a38bbd92e1f0158b1cdfc2807 to your computer and use it in GitHub Desktop.
Save flushpot1125/3c1ca27a38bbd92e1f0158b1cdfc2807 to your computer and use it in GitHub Desktop.
const STATIC_DATA = [
'/',
'/index.html',
'/model/museum.glb',
'/babylonjs_js/babylon.js',
'/babylonjs_js/babylonjs.loaders.min.js',
'/babylonjs_js/babylonjs.material.min.js',
'/babylonjs_js/babylon.gui.min.js',
'/babylonjs_js/babylon.inspector.bundle.js',
'/babylonjs_js/pep.js',
'/js/TeleportCheck.js'
];
const cacheName ='cache_v1';
self.addEventListener('install', e => {
console.log('[ServiceWorker] Install');
e.waitUntil(
caches.open(cacheName).then(cache => {
return cache.addAll(STATIC_DATA)
.then(()=> self.skipWaiting());
}));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment