mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-03 20:13:02 +00:00
b497344521
- 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
26 lines
505 B
TypeScript
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;
|
|
}
|
|
},
|
|
},
|
|
});
|