|
| 1 | +interface Window { |
| 2 | + readonly appHistory: AppHistory; |
| 3 | +} |
| 4 | + |
| 5 | +declare class AppHistory extends EventTarget { |
| 6 | + readonly current: AppHistoryEntry|null; |
| 7 | + readonly transition: AppHistoryTransition|null; |
| 8 | + |
| 9 | + entries(): AppHistoryEntry[]; |
| 10 | + |
| 11 | + readonly canGoBack: boolean; |
| 12 | + readonly canGoForward: boolean; |
| 13 | + |
| 14 | + navigate(url: string, options?: AppHistoryNavigateOptions): Promise<void>; |
| 15 | + reload(options?: AppHistoryReloadOptions): Promise<void>; |
| 16 | + |
| 17 | + goTo(key: string, options?: AppHistoryNavigationOptions): Promise<void>; |
| 18 | + back(options?: AppHistoryNavigationOptions): Promise<void>; |
| 19 | + forward(options?: AppHistoryNavigationOptions): Promise<void>; |
| 20 | + |
| 21 | + onnavigate: ((this: AppHistory, ev: AppHistoryNavigateEvent) => any)|null; |
| 22 | + onnavigatesuccess: ((this: AppHistory, ev: Event) => any)|null; |
| 23 | + onnavigateerror: ((this: AppHistory, ev: ErrorEvent) => any)|null; |
| 24 | +} |
| 25 | + |
| 26 | +declare class AppHistoryTransition { |
| 27 | + readonly navigationType: AppHistoryNavigationType; |
| 28 | + readonly from: AppHistoryEntry; |
| 29 | + readonly finished: Promise<void>; |
| 30 | + |
| 31 | + rollback(options?: AppHistoryNavigationOptions): Promise<void>; |
| 32 | +} |
| 33 | + |
| 34 | +declare class AppHistoryEntry extends EventTarget { |
| 35 | + readonly key: string; |
| 36 | + readonly id: string; |
| 37 | + readonly url: string; |
| 38 | + readonly index: number; |
| 39 | + readonly sameDocument: boolean; |
| 40 | + |
| 41 | + getState(): unknown; |
| 42 | + |
| 43 | + onnavigateto: ((this: AppHistoryEntry, ev: Event) => any)|null; |
| 44 | + onnavigatefrom: ((this: AppHistoryEntry, ev: Event) => any)|null; |
| 45 | + onfinish: ((this: AppHistoryEntry, ev: Event) => any)|null; |
| 46 | + ondispose: ((this: AppHistoryEntry, ev: Event) => any)|null; |
| 47 | +} |
| 48 | + |
| 49 | +type AppHistoryNavigationType = 'reload'|'push'|'replace'|'traverse'; |
| 50 | + |
| 51 | +interface AppHistoryNavigationOptions { |
| 52 | + navigateInfo?: unknown; |
| 53 | +} |
| 54 | + |
| 55 | +interface AppHistoryNavigateOptions extends AppHistoryNavigationOptions { |
| 56 | + state?: unknown; |
| 57 | + replace?: boolean; |
| 58 | +} |
| 59 | + |
| 60 | +interface AppHistoryReloadOptions extends AppHistoryNavigationOptions { |
| 61 | + state?: unknown; |
| 62 | +} |
| 63 | + |
| 64 | +declare class AppHistoryNavigateEvent extends Event { |
| 65 | + constructor(type: string, eventInit: AppHistoryNavigateEventInit); |
| 66 | + |
| 67 | + readonly navigationType: AppHistoryNavigationType; |
| 68 | + readonly canRespond: boolean; |
| 69 | + readonly userInitiated: boolean; |
| 70 | + readonly hashChange: boolean; |
| 71 | + readonly destination: AppHistoryDestination; |
| 72 | + readonly signal: AbortSignal; |
| 73 | + readonly formData: FormData|null; |
| 74 | + readonly info: unknown; |
| 75 | + |
| 76 | + respondWith(newNavigationAction: Promise<void>): void; |
| 77 | +} |
| 78 | + |
| 79 | +interface AppHistoryNavigateEventInit extends EventInit { |
| 80 | + navigationType?: AppHistoryNavigationType; |
| 81 | + canRespond?: boolean; |
| 82 | + userInitiated?: boolean; |
| 83 | + hashChange?: boolean; |
| 84 | + destination: AppHistoryDestination; |
| 85 | + signal: AbortSignal; |
| 86 | + formData?: FormData|null; |
| 87 | + info?: unknown; |
| 88 | +} |
| 89 | + |
| 90 | +declare class AppHistoryDestination { |
| 91 | + readonly url: string; |
| 92 | + readonly key: string|null; |
| 93 | + readonly id: string|null; |
| 94 | + readonly index: number; |
| 95 | + readonly sameDocument: boolean; |
| 96 | + |
| 97 | + getState(): unknown; |
| 98 | +} |
0 commit comments