UNPKG

1.43 kBTypeScriptView Raw
1import { Action, createBrowserHistory, createHashHistory } from 'history';
2import type { IH5RouterConfig } from '@tarojs/taro/types/compile';
3import type { Blocker, BrowserHistoryOptions, HashHistoryOptions, History, Listener, Location, Path, To } from 'history';
4import type { StateEvent } from '../types/history';
5export declare let history: History;
6declare class MpaHistory implements History {
7 action: Action;
8 get location(): Location;
9 createHref(_to: To): string;
10 parseUrl(to: Partial<Path>): string;
11 push(to: Partial<Path>, _state?: Record<string, unknown>): void;
12 replace(to: Partial<Path>, _state?: Record<string, unknown>): void;
13 go(delta: number): void;
14 back: () => void;
15 forward: () => void;
16 listen(listener: Listener): () => void;
17 block(_blocker: Blocker): () => void;
18 pushState: globalThis.History['pushState'];
19 replaceState: globalThis.History['replaceState'];
20 eventState(action: Required<StateEvent>['action']): (data: any, unused: string, url?: string | URL | null) => any;
21}
22export declare function setHistory(h: History, base?: string): void;
23export declare function createMpaHistory(_?: HashHistoryOptions | BrowserHistoryOptions): MpaHistory;
24export { createBrowserHistory, createHashHistory };
25export declare function setHistoryMode(mode?: IH5RouterConfig['mode'], base?: string): void;
26export declare function prependBasename(url?: string): string;