Delete: pwa useless code

This commit is contained in:
unitwk 2022-11-13 18:01:53 +08:00
parent b852caeb98
commit 0c61cd3291
2 changed files with 7 additions and 43 deletions

View File

@ -1,7 +1,7 @@
// Copyright (C) 2022 MCSManager <mcsmanager-dev@outlook.com>
import { createApp } from "vue";
import i18n from "./i18n"
import i18n from "./i18n";
import elementPlus from "element-plus";
import "element-plus/dist/index.css";
@ -15,22 +15,17 @@ import "../assets/css/dark-mode.scss";
import App from "./App.vue";
import "./service/protocol";
import directive from "./directive"
// PWA
// import '../registerServiceWorker'
import directive from "./directive";
const app = createApp(App);
// Vuex
// Vuex
import store from "./store";
app.use(store);
app.use(i18n)
app.use(i18n);
// custom directive
directive(app)
directive(app);
// Vue-Router
import router from "./router";
@ -51,6 +46,6 @@ app.component("FunctionGroup", FunctionGroup);
app.component("FunctionComponent", FunctionGroupComponent);
app.mount("#app");
if ((localStorage.getItem("theme"))) {
document.body.setAttribute("class", localStorage.getItem("theme"));
if (localStorage.getItem("theme")) {
document.body.setAttribute("class", localStorage.getItem("theme"));
}

View File

@ -1,31 +0,0 @@
/* eslint-disable no-console */
import { register } from 'register-service-worker'
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 () {
document.getElementById('UpdateNote').style = 'position: fixed; bottom: 8px; right: 8px; opacity: 1; visibility: visible; transition: all 0.2s;'
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)
}
})