UNPKG

rwsdk

Version:

Build fast, server-driven webapps on Cloudflare with SSR, RSC, and realtime

29 lines (28 loc) 1.45 kB
export interface NavigationSnapshot { /** URL represented by the React tree that has committed to the screen. */ currentUrl: URL; /** The latest client navigation that has updated history but not committed. */ pending: PendingNavigationSnapshot | null; } export interface PendingNavigationSnapshot { id: number; /** URL represented by the currently visible React tree when navigation began. */ currentUrl: URL; /** URL that the pending RSC navigation is rendering. */ pendingUrl: URL; /** Resolves when this pending navigation commits, is superseded, or is aborted. */ promise: Promise<void>; } interface PendingNavigationInternal extends PendingNavigationSnapshot { resolve: () => void; } type NavigationListener = () => void; export declare function isSameNavigationDocumentUrl(left: string | URL, right: string | URL): boolean; export declare function subscribeNavigationState(listener: NavigationListener): () => void; export declare function getNavigationSnapshot(): NavigationSnapshot; export declare function beginPendingNavigation(url: string | URL): PendingNavigationInternal; export declare function isPendingNavigationCommit(href?: string | URL): boolean; export declare function commitPendingNavigation(href?: string | URL): boolean; export declare function abortPendingNavigation(id?: number): boolean; export declare function resetNavigationStateForTests(href?: string): void; export {};