mirror of
https://codeberg.org/SafeTwitch/safetwitch.git
synced 2024-12-21 21:03:00 -05:00
Create PWA support #87
This commit is contained in:
parent
7431b7f1bf
commit
89e177d8b1
3 changed files with 5545 additions and 169 deletions
5670
package-lock.json
generated
5670
package-lock.json
generated
File diff suppressed because it is too large
Load diff
12
package.json
12
package.json
|
@ -3,13 +3,13 @@
|
|||
"version": "2.3.1",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "run-p type-check \"build-only {@}\" --",
|
||||
"preview": "vite preview",
|
||||
"build-only": "vite build",
|
||||
"type-check": "vue-tsc --noEmit -p tsconfig.app.json --composite false",
|
||||
"lint": "eslint . --ext .vue,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
|
||||
"format": "prettier --write src/"
|
||||
"build-only": "vite build",
|
||||
"dev": "vite",
|
||||
"format": "prettier --write src/",
|
||||
"preview": "vite preview",
|
||||
"type-check": "vue-tsc --noEmit -p tsconfig.app.json --composite false"
|
||||
},
|
||||
"dependencies": {
|
||||
"@intlify/unplugin-vue-i18n": "^0.11.0",
|
||||
|
@ -17,6 +17,7 @@
|
|||
"@types/vue-i18n": "^7.0.0",
|
||||
"hls.js": "^1.4.10",
|
||||
"oh-vue-icons": "^1.0.0-rc3",
|
||||
"register-service-worker": "^1.7.2",
|
||||
"video.js": "^8.0.4",
|
||||
"videojs-contrib-quality-levels": "^3.0.0",
|
||||
"videojs-hls-quality-selector": "^1.1.4",
|
||||
|
@ -34,6 +35,7 @@
|
|||
"@types/videojs-contrib-quality-levels": "^2.0.1",
|
||||
"@types/videojs-hls-quality-selector": "^1.1.0",
|
||||
"@vitejs/plugin-vue": "^4.4.0",
|
||||
"@vue/cli-plugin-pwa": "~5.0.0",
|
||||
"@vue/eslint-config-prettier": "^8.0.0",
|
||||
"@vue/eslint-config-typescript": "^12.0.0",
|
||||
"@vue/tsconfig": "^0.4.0",
|
||||
|
|
32
src/registerServiceWorker.js
Normal file
32
src/registerServiceWorker.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
/* eslint-disable no-console */
|
||||
|
||||
import { register } from 'register-service-worker'
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
register(`${process.env.BASE_URL}service-worker.js`, {
|
||||
ready () {
|
||||
console.log(
|
||||
'App is being served from cache by a service worker.\n' +
|
||||
'For more details, visit https://goo.gl/AFskqB'
|
||||
)
|
||||
},
|
||||
registered () {
|
||||
console.log('Service worker has been registered.')
|
||||
},
|
||||
cached () {
|
||||
console.log('Content has been cached for offline use.')
|
||||
},
|
||||
updatefound () {
|
||||
console.log('New content is downloading.')
|
||||
},
|
||||
updated () {
|
||||
console.log('New content is available; please refresh.')
|
||||
},
|
||||
offline () {
|
||||
console.log('No internet connection found. App is running in offline mode.')
|
||||
},
|
||||
error (error) {
|
||||
console.error('Error during service worker registration:', error)
|
||||
}
|
||||
})
|
||||
}
|
Loading…
Reference in a new issue