123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368 |
- export declare enum Action {
-
- Pop = "POP",
-
- Push = "PUSH",
-
- Replace = "REPLACE"
- }
- export declare type Pathname = string;
- export declare type Search = string;
- export declare type Hash = string;
- export declare type State = object | null;
- export declare type Key = string;
- export interface Path {
-
- pathname: Pathname;
-
- search: Search;
-
- hash: Hash;
- }
- export interface Location<S extends State = State> extends Path {
-
- state: S;
-
- key: Key;
- }
- export interface PartialPath {
-
- pathname?: Pathname;
-
- search?: Search;
-
- hash?: Hash;
- }
- export interface PartialLocation<S extends State = State> extends PartialPath {
-
- state?: S;
-
- key?: Key;
- }
- export interface Update<S extends State = State> {
-
- action: Action;
-
- location: Location<S>;
- }
- export interface Listener<S extends State = State> {
- (update: Update<S>): void;
- }
- export interface Transition<S extends State = State> extends Update<S> {
-
- retry(): void;
- }
- export interface Blocker<S extends State = State> {
- (tx: Transition<S>): void;
- }
- export declare type To = string | PartialPath;
- export interface History<S extends State = State> {
-
- readonly action: Action;
-
- readonly location: Location<S>;
-
- createHref(to: To): string;
-
- push(to: To, state?: S): void;
-
- replace(to: To, state?: S): void;
-
- go(delta: number): void;
-
- back(): void;
-
- forward(): void;
-
- listen(listener: Listener<S>): () => void;
-
- block(blocker: Blocker<S>): () => void;
- }
- export interface BrowserHistory<S extends State = State> extends History<S> {
- }
- export interface HashHistory<S extends State = State> extends History<S> {
- }
- export interface MemoryHistory<S extends State = State> extends History<S> {
- index: number;
- }
- export declare type BrowserHistoryOptions = {
- window?: Window;
- };
- export declare function createBrowserHistory(options?: BrowserHistoryOptions): BrowserHistory;
- export declare type HashHistoryOptions = {
- window?: Window;
- };
- export declare function createHashHistory(options?: HashHistoryOptions): HashHistory;
- export declare type InitialEntry = string | PartialLocation;
- export declare type MemoryHistoryOptions = {
- initialEntries?: InitialEntry[];
- initialIndex?: number;
- };
- export declare function createMemoryHistory(options?: MemoryHistoryOptions): MemoryHistory;
- export declare function createPath({ pathname, search, hash }: PartialPath): string;
- export declare function parsePath(path: string): PartialPath;
|