diff options
| -rw-r--r-- | README.md | 1 | ||||
| -rw-r--r-- | app/app.js | 10 | ||||
| -rw-r--r-- | app/tilecache.sw.js | 27 | ||||
| -rw-r--r-- | package.json | 13 |
4 files changed, 6 insertions, 45 deletions
@@ -71,7 +71,6 @@ sudo apt install icnsutils graphicsmagick - **routes.js** - routes configurator - **store.js** - redux store configurator - **enums.js** - common enums used across components - - **tilecache.sw.js** - service worker for caching mapbox requests - **test/** - tests - **scripts/** - support scripts for development - **init.js** - entry file for electron, points to compiled **main.js** diff --git a/app/app.js b/app/app.js index 7fc4e111d7..656e7dd5c0 100644 --- a/app/app.js +++ b/app/app.js @@ -1,6 +1,5 @@ // @flow -import path from 'path'; import React from 'react'; import ReactDOM from 'react-dom'; import { Provider } from 'react-redux'; @@ -85,15 +84,6 @@ updateTrayIcon(); // disable smart pinch. webFrame.setZoomLevelLimits(1, 1); -if(navigator.serviceWorker) { - navigator.serviceWorker.register(path.join(__dirname, 'tilecache.sw.js')) - .then((registration) => { - log.info('ServiceWorker registration successful with scope: ', registration.scope); - }).catch((err) => { - log.info('ServiceWorker registration failed: ', err); - }); -} - ipcRenderer.send('on-browser-window-ready'); function getRootElement() { diff --git a/app/tilecache.sw.js b/app/tilecache.sw.js deleted file mode 100644 index 15ec8f9493..0000000000 --- a/app/tilecache.sw.js +++ /dev/null @@ -1,27 +0,0 @@ - -this.addEventListener('install', function (event) { - console.log('Installing Service Worker'); - event.waitUntil(this.skipWaiting()); -}); - -this.addEventListener('activate', function (event) { - event.waitUntil(this.clients.claim()); -}); - -this.addEventListener('fetch', function(event) { - var url = event.request.url; - - if(url.startsWith('https://') && (url.includes('tiles.mapbox.com') || url.includes('api.mapbox.com'))) { - event.respondWith( - caches.match(event.request).then(function(resp) { - return resp || fetch(event.request).then(function(response) { - var cacheResponse = response.clone(); - caches.open('mapbox').then(function(cache) { - cache.put(event.request, cacheResponse); - }); - return response; - }); - }) - ); - } -}); diff --git a/package.json b/package.json index 99318b1ce2..35d82f0d26 100644 --- a/package.json +++ b/package.json @@ -67,14 +67,14 @@ }, "scripts": { "postinstall": "electron-builder install-app-deps", - "develop": "npm run private:compile -- --source-maps true && npm run private:service-worker && run-p -r private:watch private:serve", + "develop": "npm run private:compile -- --source-maps true && run-p -r private:watch private:serve", "test": "electron-mocha --renderer -R spec --compilers js:babel-core/register --require-main test/setup/main.js test/*.spec.js test/**/*.spec.js", "lint": "eslint --no-ignore scripts app test *.js", "flow": "flow", - "pack": "run-s private:clean private:compile private:service-worker private:build:all", - "pack:mac": "./pre-mac-sign.sh && run-s private:clean private:compile private:service-worker private:build:mac", - "pack:win": "run-s private:clean private:compile private:service-worker private:build:win", - "pack:linux": "run-s private:clean private:compile private:service-worker private:build:linux", + "pack": "run-s private:clean private:compile private:build:all", + "pack:mac": "./pre-mac-sign.sh && run-s private:clean private:compile private:build:mac", + "pack:win": "run-s private:clean private:compile private:build:win", + "pack:linux": "run-s private:clean private:compile private:build:linux", "private:build:all": "npm run private:build -- -mwl", "private:build:mac": "npm run private:build -- --mac", "private:build:win": "npm run private:build -- --win", @@ -82,8 +82,7 @@ "private:build": "electron-builder", "private:watch": "npm run private:compile -- --source-maps true --watch --skip-initial-build", "private:serve": "babel-node scripts/serve.js", - "private:compile": "babel app/ --copy-files --ignore *.sw.js --out-dir build", - "private:service-worker": "cp app/*.sw.js build", + "private:compile": "babel app/ --copy-files --out-dir build", "private:clean": "rimraf build" } } |
