feat: refactor how frontend was structured
Some checks failed
Deploy to GitHub Pages / build_site (push) Failing after 1m16s

This commit is contained in:
2024-04-25 01:53:20 +02:00
parent f51f61df17
commit c28ef550a9
18 changed files with 264 additions and 225 deletions

View File

@@ -1,6 +1,6 @@
import { readable, type Readable } from "svelte/store";
type PerformanceData = {
export type PerformanceData = {
total: Record<string, number>;
runs: Record<string, number[]>[];
}
@@ -8,6 +8,7 @@ export interface PerformanceStore extends Readable<PerformanceData> {
startRun(): void;
stopRun(): void;
addPoint(name: string, value?: number): void;
get: () => PerformanceData;
}
export function createPerformanceStore(): PerformanceStore {
@@ -41,7 +42,7 @@ export function createPerformanceStore(): PerformanceStore {
data.runs.push(currentRun);
currentRun = undefined;
set(data);
if (set) set(data);
}
}
@@ -51,11 +52,16 @@ export function createPerformanceStore(): PerformanceStore {
currentRun[name].push(value);
}
function get() {
return data;
}
return {
subscribe,
startRun,
stopRun,
addPoint,
get
}
}