This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<button | |
v-if="updateExists" | |
@click="refreshApp" | |
> | |
New version available! Click to update | |
</button> | |
</template> | |
<script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<v-app> | |
<v-app-bar | |
color="primary" | |
app | |
dark | |
> | |
<v-app-bar-nav-icon></v-app-bar-nav-icon> | |
<v-toolbar-title>Title</v-toolbar-title> | |
<v-spacer></v-spacer> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { register } from 'register-service-worker'; | |
if (process.env.NODE_ENV === 'production') { | |
register(`${process.env.BASE_URL}service-worker.js`, { | |
ready () { | |
console.log('Service worker is active.'); | |
}, | |
registered (registration) { | |
console.log('Service worker has been registered.'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is the code piece that GenerateSW mode can't provide for us. | |
// This code listens for the user's confirmation to update the app. | |
self.addEventListener('message', (e) => { | |
if (!e.data) { | |
return; | |
} | |
switch (e.data) { | |
case 'skipWaiting': | |
self.skipWaiting(); |