UNPKG

react-use-url-state

Version:
26 lines (25 loc) 828 B
export type Callback = (newParams: Record<string, string | string[]>) => void; export interface UrlStateControllerInterface { push(href: string): void; subscribe(fn: Callback): void; unsubscribe(fn: Callback): void; } export type UrlStateControllerOptions = { poolingIntervalMs?: number; }; export declare class UrlStateController implements UrlStateControllerInterface { private options; static singleton: UrlStateController | null; private stateString; private previousHref; private interval; private subscribers; private constructor(); static getUrlStateController(): UrlStateController; push(href: string): void; subscribe(fn: Callback): void; unsubscribe(fn: Callback): void; onSearchParamsChange(): void; private startPolling; private stopPolling; }