mirror of
https://github.com/Spythere/pojazdownik.git
synced 2026-05-02 21:08:12 +00:00
pwa: automatyczny reload
This commit is contained in:
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vue-tsc --noEmit && vite build",
|
"build": "vue-tsc --noEmit && vite build",
|
||||||
"preview": "vite preview"
|
"preview": "yarn build && vite preview --port 4174"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"pinia": "^2.0.17",
|
"pinia": "^2.0.17",
|
||||||
|
|||||||
+3
-1
@@ -69,7 +69,9 @@ export default defineComponent({
|
|||||||
}),
|
}),
|
||||||
|
|
||||||
async created() {
|
async created() {
|
||||||
const stockData = await (await fetch(`https://spythere.github.io/api/stockDataNew.json?t=${Math.floor(Date.now() / 60000)}`)).json();
|
const stockData = await (
|
||||||
|
await fetch(`https://spythere.github.io/api/stockDataNew.json?t=${Math.floor(Date.now() / 60000)}`)
|
||||||
|
).json();
|
||||||
|
|
||||||
this.store.stockData = stockData;
|
this.store.stockData = stockData;
|
||||||
},
|
},
|
||||||
|
|||||||
+11
-3
@@ -1,10 +1,18 @@
|
|||||||
import { createApp } from 'vue';
|
import { createApp } from 'vue';
|
||||||
import { createPinia } from 'pinia';
|
import { createPinia } from 'pinia';
|
||||||
|
import { registerSW } from 'virtual:pwa-register';
|
||||||
|
|
||||||
import App from './App.vue';
|
import App from './App.vue';
|
||||||
|
|
||||||
const pinia = createPinia();
|
const pinia = createPinia();
|
||||||
|
|
||||||
createApp(App)
|
const updateSW = registerSW({
|
||||||
.use(pinia)
|
onOfflineReady() {},
|
||||||
.mount('#app');
|
|
||||||
|
onNeedRefresh() {
|
||||||
|
console.log('Need refresh!');
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
createApp(App).use(pinia).mount('#app');
|
||||||
|
|
||||||
|
|||||||
+4
-1
@@ -11,7 +11,10 @@
|
|||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"lib": ["ESNext", "DOM"],
|
"lib": ["ESNext", "DOM"],
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true,
|
||||||
|
"types": [
|
||||||
|
"vite-plugin-pwa/client"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
|
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
|
||||||
"references": [{ "path": "./tsconfig.node.json" }]
|
"references": [{ "path": "./tsconfig.node.json" }]
|
||||||
|
|||||||
Reference in New Issue
Block a user