aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorneauoire <[email protected]>2019-11-18 16:20:04 -0500
committerneauoire <[email protected]>2019-11-18 16:20:04 -0500
commit7b10b04b3e8b665afebd954d4a9b0c19f50cc1e7 (patch)
treed38419062dfb223df38ca16ff359e7e990876c0e
parenta74f56cfa4930083bfab48a0adeb09910f338aee (diff)
downloadOrca-7b10b04b3e8b665afebd954d4a9b0c19f50cc1e7.tar.gz
Orca-7b10b04b3e8b665afebd954d4a9b0c19f50cc1e7.zip
Linted
-rw-r--r--sw.js64
1 files changed, 22 insertions, 42 deletions
diff --git a/sw.js b/sw.js
index bcf25d0..cf1c5be 100644
--- a/sw.js
+++ b/sw.js
@@ -1,18 +1,14 @@
// 220
const assets = [
-
'./',
-
'./manifest.json',
'./desktop/icon.png',
-
'./desktop/sources/links/style.css',
'./desktop/sources/links/reset.css',
'./desktop/sources/links/fonts.css',
'./desktop/sources/links/main.css',
'./desktop/sources/links/theme.css',
-
'./desktop/sources/scripts/lib/acels.js',
'./desktop/sources/scripts/lib/theme.js',
'./desktop/sources/scripts/lib/history.js',
@@ -31,43 +27,27 @@ const assets = [
'./desktop/sources/scripts/commander.js',
'./desktop/sources/scripts/cursor.js',
'./desktop/sources/scripts/client.js'
-
-];
-
-self.addEventListener( 'install', async function () {
-
- const cache = await caches.open( 'Orca' );
-
- assets.forEach( function ( asset ) {
-
- cache.add( asset ).catch( function () {
-
- console.error( '[SW] Cound\'t cache:', asset );
-
- } );
-
- } );
-
-} );
-
-self.addEventListener( 'fetch', async function ( event ) {
-
- const request = event.request;
- event.respondWith( cacheFirst( request ) );
-
-} );
-
-async function cacheFirst( request ) {
-
- const cachedResponse = await caches.match( request );
-
- if ( cachedResponse === undefined ) {
-
- console.error( '[SW] Not cached:', request.url );
- return fetch( request );
-
+]
+
+self.addEventListener('install', async function () {
+ const cache = await caches.open('Orca')
+ assets.forEach(function (asset) {
+ cache.add(asset).catch(function () {
+ console.error('[SW] Cound\'t cache:', asset)
+ })
+ })
+})
+
+self.addEventListener('fetch', async function (event) {
+ const request = event.request
+ event.respondWith(cacheFirst(request))
+})
+
+async function cacheFirst (request) {
+ const cachedResponse = await caches.match(request)
+ if (cachedResponse === undefined) {
+ console.error('[SW] Not cached:', request.url)
+ return fetch(request)
}
-
- return cachedResponse;
-
+ return cachedResponse
}