slige/web/public/src/data.ts

32 lines
745 B
TypeScript
Raw Normal View History

2024-12-06 13:17:07 +01:00
export type FlameGraphNode = {
fn: number;
acc: number;
parent: number;
children: FlameGraphNode[];
};
2024-12-12 11:56:22 +01:00
export async function flameGraphData(): Promise<FlameGraphNode> {
return await fetch("/api/flame-graph")
.then((v) => v.json())
.then((v) => v.flameGraph);
2024-12-06 13:17:07 +01:00
}
2024-12-12 11:56:22 +01:00
export async function codeData(): Promise<string> {
return await fetch("/api/source")
.then((v) => v.json())
.then((v) => v.text);
2024-12-06 13:17:07 +01:00
}
export type CodeCovEntry = {
index: number;
line: number;
col: number;
covers: number;
};
2024-12-12 11:56:22 +01:00
export async function codeCoverageData(): Promise<CodeCovEntry[]> {
return await fetch("/api/code-coverage")
.then((v) => v.json())
.then((v) => v.codeCoveragea);
2024-12-06 13:17:07 +01:00
}