Skip to content
Source
Sign inSign up
fuko/trytanstackdb-v2
Open History to see the last commit

latency.ts

9 lines373 Bytes

1/** Latency presets for the fake API, in milliseconds (wired up in phase 4). */
2export const LATENCY_PRESETS = [0, 500, 2000, 5000] as const;
3​
4export type LatencyPreset = (typeof LATENCY_PRESETS)[number];
5​
6/** `0` → "0 ms", `500` → "500 ms", `2000` → "2 s". */
7export function formatLatency(ms: number): string {
8 return ms < 1000 ? `${ms} ms` : `${ms / 1000} s`;
9}