Files
swingmusic-extended/src/stores/loader.ts
T
geoffrey45 b497344521 refactor logo, bottom bar and perks.js
- add new logo
- add tsconfig.json
- move logo to new component
- update bottombar
- remove props from hotkeys and progress bar
- convert perks.js -> perks.ts
2022-05-24 15:55:26 +03:00

26 lines
505 B
TypeScript

import { defineStore } from "pinia";
export default defineStore("Loader", {
state: () => ({
loading: false,
duration: 0,
}),
actions: {
startLoading() {
this.loading = true;
this.duration = new Date().getTime();
},
stopLoading() {
const diff = new Date().getTime() - this.duration;
if (diff <= 250) {
setTimeout(() => {
this.loading = false;
}, 250 - diff);
} else {
this.loading = false;
}
},
},
});