rooks
Version:
Collection of awesome react hooks
16 lines (15 loc) • 577 B
TypeScript
import type { Temporal } from "@js-temporal/polyfill";
type TemporalApi = typeof Temporal;
/**
* Returns the Temporal API if already available (native or cached polyfill).
* Safe to call with non-null assertion (!) in code paths guarded by
* useLoadTemporal().
*/
export declare function getTemporalApi(): TemporalApi | null;
/**
* React hook that lazily loads the Temporal API.
* Prefers native globalThis.Temporal over the polyfill.
* Returns the API once available, or null while loading.
*/
export declare function useLoadTemporal(): TemporalApi | null;
export {};