➕ (retrobus) use retrobus
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
"core-js": "^3.6.5",
|
||||
"plyr": "^3.6.2",
|
||||
"register-service-worker": "^1.7.1",
|
||||
"sw-new-version": "^1.0.1",
|
||||
"retrobus": "^1.0.1",
|
||||
"vue": "^2.6.11",
|
||||
"vue-i18n": "^8.17.3",
|
||||
"vue-router": "^3.2.0",
|
||||
|
||||
@@ -10,17 +10,19 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, ref, onMounted } from '@vue/composition-api'
|
||||
import { serviceWorkerVersionListener } from 'sw-new-version'
|
||||
import { addEventBusListener } from 'retrobus'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'SWNewVersion',
|
||||
setup() {
|
||||
const newVersion = ref(serviceWorkerVersionListener.getNewVersion)
|
||||
const newVersion = ref(false)
|
||||
|
||||
onMounted(() => {
|
||||
serviceWorkerVersionListener.listenToNewVersion(
|
||||
(version) => (newVersion.value = version)
|
||||
)
|
||||
addEventBusListener('new-version', () => (newVersion.value = true)),
|
||||
{
|
||||
retro: true,
|
||||
once: true
|
||||
}
|
||||
})
|
||||
|
||||
return {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { register } from 'register-service-worker'
|
||||
import { setNotificationInstance, notify } from './utils/notification'
|
||||
import i18n from '@/i18n'
|
||||
import { serviceWorkerVersionListener } from 'sw-new-version'
|
||||
import { emit } from 'retrobus'
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
register(`${process.env.BASE_URL}service-worker.js`, {
|
||||
@@ -34,7 +34,7 @@ if (process.env.NODE_ENV === 'production') {
|
||||
body: i18n.t('notification.update.body').toString(),
|
||||
tag: 'new-version'
|
||||
})
|
||||
serviceWorkerVersionListener.hasNewVersion()
|
||||
emit('new-version')
|
||||
},
|
||||
offline() {
|
||||
console.log(
|
||||
|
||||
10
yarn.lock
10
yarn.lock
@@ -7418,6 +7418,11 @@ ret@~0.1.10:
|
||||
resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc"
|
||||
integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==
|
||||
|
||||
retrobus@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/retrobus/-/retrobus-1.0.1.tgz#69bd7192b363d0aa4e47350e209bc1b07439aab3"
|
||||
integrity sha512-TLaSvnycUsro1+L62C+J+bmD3Y/BWnOZ4L/4qMBJvkfecFodo7QgtVWLXU8Zs4tAOoPMUcu62dSy2CsP4QyuGA==
|
||||
|
||||
retry@^0.12.0:
|
||||
version "0.12.0"
|
||||
resolved "https://registry.yarnpkg.com/retry/-/retry-0.12.0.tgz#1b42a6266a21f07421d1b0b54b7dc167b01c013b"
|
||||
@@ -8221,11 +8226,6 @@ svgo@^1.0.0:
|
||||
unquote "~1.1.1"
|
||||
util.promisify "~1.0.0"
|
||||
|
||||
sw-new-version@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/sw-new-version/-/sw-new-version-1.0.1.tgz#324cb379640fcf697401d27b7c7e107cbc18205a"
|
||||
integrity sha512-pVCQiIHNMflYEYiNbVK+S0CtV1eQwp+bg5JZ0zgU+TWN2CNd0rw3pjhhD9cnk6rtArIv2GAPFsul6cuU+xdrdQ==
|
||||
|
||||
table@^5.2.3:
|
||||
version "5.4.6"
|
||||
resolved "https://registry.yarnpkg.com/table/-/table-5.4.6.tgz#1292d19500ce3f86053b05f0e8e7e4a3bb21079e"
|
||||
|
||||
Reference in New Issue
Block a user