UNPKG

react-shared-states

Version:

Global state made as simple as useState, with zero config, built-in async caching, and automatic scoping.

12 lines (11 loc) 365 B
export type PotentialPromise<T> = T | Promise<T>; export type AFunction<R = unknown, Args extends unknown[] = unknown[]> = (...args: Args) => PotentialPromise<R>; export type Prefix = "_global" | ({} & string); export interface SharedValue { listeners: AFunction[]; isStatic?: true; } export interface SharedCreated { key: string; prefix: string; }