reactant-share
Version:
A framework for building shared web applications with Reactant
62 lines • 2.68 kB
TypeScript
import { Router as BaseReactantRouter, RouterOptions } from 'reactant-router';
import type { IRouterOptions as IBaseRouterOptions, RouterState } from 'reactant-router';
import type { LocationState } from 'history';
import type { ISharedAppOptions } from '../interfaces';
import { PortDetector } from './portDetector';
export { createBrowserHistory, createHashHistory, createMemoryHistory, } from 'reactant-router';
export interface IRouterOptions extends IBaseRouterOptions {
/**
* default initial route
*/
defaultRoute?: string;
/**
* The maximum number of historical records stored in the browser, the default is 10.
*/
maxHistoryLength?: number;
}
declare class ReactantRouter extends BaseReactantRouter {
protected portDetector: PortDetector;
protected sharedAppOptions: ISharedAppOptions;
protected options: IRouterOptions;
private passiveRoute;
private cachedHistory;
private forwardHistory;
private firstRenderingSync;
private firstRenderingSyncResolve;
private firstActiveSync;
private firstActiveSyncResolve;
/**
* The promise of the first client sync.
*/
firstClientSync: Promise<[void, void]>;
constructor(portDetector: PortDetector, sharedAppOptions: ISharedAppOptions, options: IRouterOptions);
get maxHistoryLength(): number;
watchRehydratedRouting(): () => void;
compareRouter(router1: RouterState, router2: RouterState): boolean;
/**
* The timestamp of the last routing.
*/
lastRoutedTimestamp: number;
protected _changeRoutingOnSever(name: string, router: RouterState, timestamp: number, clientId?: string): void;
protected _changeRoutingOnClient(name: string, router: RouterState, timestamp?: number): void;
protected _makeRoutingOnClient({ args, action, name, }: {
args: any[];
action: 'push' | 'replace' | 'go' | 'goBack' | 'goForward';
name: string;
}): Promise<unknown>;
toBeRouted: (() => void) | null;
protected _routers: Record<string, RouterState | undefined>;
protected _setRouters(name: string, router: RouterState): void;
protected get defaultRoute(): string;
protected get enableCacheRouting(): any;
protected defaultHistory: RouterState;
protected dispatchChanged(router?: RouterState): void;
get currentPath(): any;
push(path: string, locationState?: LocationState): Promise<void>;
replace(path: string, locationState?: LocationState): Promise<void>;
go(n: number): Promise<void>;
goBack(): Promise<void>;
goForward(): Promise<void>;
}
export { ReactantRouter as Router, RouterOptions };
//# sourceMappingURL=router.d.ts.map