Skip to content

Commit f6031fa

Browse files
committed
PWA(Progressive web app) support added
1 parent 8320716 commit f6031fa

21 files changed

+464
-5
lines changed

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"pouchdb-debug": "^7.2.1",
3737
"pouchdb-find": "^7.2.1",
3838
"pouchdb-live-find": "^0.4.0",
39+
"register-service-worker": "^1.7.1",
3940
"vue": "^2.6.10",
4041
"vue-chartjs": "^3.5.0",
4142
"vue-router": "^3.1.5",
@@ -46,6 +47,7 @@
4647
"@mdi/font": "^4.8.95",
4748
"@vue/cli-plugin-babel": "^4.1.0",
4849
"@vue/cli-plugin-eslint": "^4.1.0",
50+
"@vue/cli-plugin-pwa": "^4.3.1",
4951
"@vue/cli-plugin-router": "^4.1.0",
5052
"@vue/cli-plugin-vuex": "^4.1.0",
5153
"@vue/cli-service": "^4.1.0",
9.2 KB
Loading
29.1 KB
Loading
Loading
Loading
3.29 KB
Loading
3.95 KB
Loading
4.57 KB
Loading
1.46 KB
Loading
1.78 KB
Loading

public/img/icons/apple-touch-icon.png

4.57 KB
Loading

public/img/icons/favicon-16x16.png

799 Bytes
Loading

public/img/icons/favicon-32x32.png

1.24 KB
Loading
1.14 KB
Loading

public/img/icons/mstile-150x150.png

4.18 KB
Loading
+149
Loading

public/robots.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
User-agent: *
2+
Disallow:

src/main.js

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import App from './App.vue'
33
import router from './router'
44
import store from './store'
55
import vuetify from './plugins/vuetify';
6+
import './registerServiceWorker'
67

78
Vue.config.productionTip = false
89

src/registerServiceWorker.js

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/* eslint-disable no-console */
2+
3+
import { register } from 'register-service-worker'
4+
5+
if (process.env.NODE_ENV === 'production') {
6+
register(`${process.env.BASE_URL}service-worker.js`, {
7+
ready () {
8+
console.log(
9+
'App is being served from cache by a service worker.\n' +
10+
'For more details, visit https://goo.gl/AFskqB'
11+
)
12+
},
13+
registered () {
14+
console.log('Service worker has been registered.')
15+
},
16+
cached () {
17+
console.log('Content has been cached for offline use.')
18+
},
19+
updatefound () {
20+
console.log('New content is downloading.')
21+
},
22+
updated () {
23+
console.log('New content is available; please refresh.')
24+
},
25+
offline () {
26+
console.log('No internet connection found. App is running in offline mode.')
27+
},
28+
error (error) {
29+
console.error('Error during service worker registration:', error)
30+
}
31+
})
32+
}

vue.config.js

+16
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,21 @@ module.exports = {
1010
"artifactName": "${productName}_desktop.${ext}"
1111
}
1212
}
13+
},
14+
pwa: {
15+
name: 'pimpim',
16+
themeColor: '#4DBA87',
17+
msTileColor: '#000000',
18+
appleMobileWebAppCapable: 'yes',
19+
appleMobileWebAppStatusBarStyle: 'black',
20+
//workboxPluginMode: 'InjectManifest',
21+
workboxPluginMode: 'GenerateSW',
22+
/* no need for InjectManifest yet.
23+
workboxOptions: {
24+
// swSrc is required in InjectManifest mode.
25+
swSrc: 'src/service-worker.js',
26+
// ...other Workbox options...
27+
}
28+
*/
1329
}
1430
}

0 commit comments

Comments
 (0)