forge
Explore
Log in

Don't you dare go Hollow

hezarfen_frontend

Clone
★ 0

0 watching0 forksTypeScript5.5 MiB078b459Burak Boduroğlu2 months ago671 commits

getTime.ts11 lines, 409 bytesHistoryRawDownload
1import { client } from "@/api/client";
2
3let pendingTimePromise: Promise<{ now: number }> | null = null;
4
5export async function getTime(signal?: AbortSignal): Promise<{ now: number }> {
6 if (pendingTimePromise) return pendingTimePromise;
7 pendingTimePromise = client<{ now: number }>("/time", { signal, cache: "no-store" }).finally(() => {
8 pendingTimePromise = null;
9 });
10 return pendingTimePromise;
11}