-
Notifications
You must be signed in to change notification settings - Fork 28
Create app_history.d.ts #140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
interface Window { | ||
readonly appHistory: AppHistory; | ||
} | ||
|
||
declare class AppHistory extends EventTarget { | ||
readonly current: AppHistoryEntry|null; | ||
readonly transition: AppHistoryTransition|null; | ||
|
||
entries(): AppHistoryEntry[]; | ||
|
||
readonly canGoBack: boolean; | ||
readonly canGoForward: boolean; | ||
|
||
navigate(url: string, options?: AppHistoryNavigateOptions): Promise<void>; | ||
reload(options?: AppHistoryReloadOptions): Promise<void>; | ||
|
||
goTo(key: string, options?: AppHistoryNavigationOptions): Promise<void>; | ||
back(options?: AppHistoryNavigationOptions): Promise<void>; | ||
forward(options?: AppHistoryNavigationOptions): Promise<void>; | ||
|
||
onnavigate: ((this: AppHistory, ev: AppHistoryNavigateEvent) => any)|null; | ||
onnavigatesuccess: ((this: AppHistory, ev: Event) => any)|null; | ||
onnavigateerror: ((this: AppHistory, ev: ErrorEvent) => any)|null; | ||
} | ||
|
||
declare class AppHistoryTransition { | ||
readonly navigationType: AppHistoryNavigationType; | ||
readonly from: AppHistoryEntry; | ||
readonly finished: Promise<void>; | ||
|
||
rollback(options?: AppHistoryNavigationOptions): Promise<void>; | ||
} | ||
|
||
declare class AppHistoryEntry extends EventTarget { | ||
readonly key: string; | ||
readonly id: string; | ||
readonly url: string; | ||
readonly index: number; | ||
readonly sameDocument: boolean; | ||
|
||
getState(): unknown; | ||
|
||
onnavigateto: ((this: AppHistoryEntry, ev: Event) => any)|null; | ||
onnavigatefrom: ((this: AppHistoryEntry, ev: Event) => any)|null; | ||
onfinish: ((this: AppHistoryEntry, ev: Event) => any)|null; | ||
ondispose: ((this: AppHistoryEntry, ev: Event) => any)|null; | ||
} | ||
|
||
type AppHistoryNavigationType = 'reload'|'push'|'replace'|'traverse'; | ||
|
||
interface AppHistoryNavigationOptions { | ||
navigateInfo?: unknown; | ||
} | ||
|
||
interface AppHistoryNavigateOptions extends AppHistoryNavigationOptions { | ||
state?: unknown; | ||
replace?: boolean; | ||
} | ||
|
||
interface AppHistoryReloadOptions extends AppHistoryNavigationOptions { | ||
state?: unknown; | ||
} | ||
|
||
declare class AppHistoryNavigateEvent extends Event { | ||
tbondwilkinson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
constructor(type: string, eventInit: AppHistoryNavigateEventInit); | ||
|
||
readonly navigationType: AppHistoryNavigationType; | ||
readonly canRespond: boolean; | ||
readonly userInitiated: boolean; | ||
readonly hashChange: boolean; | ||
readonly destination: AppHistoryDestination; | ||
readonly signal: AbortSignal; | ||
readonly formData: FormData|null; | ||
readonly info: unknown; | ||
|
||
respondWith(newNavigationAction: Promise<void>): void; | ||
} | ||
|
||
declare class AppHistoryNavigateEventInit extends EventInit { | ||
tbondwilkinson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
navigationType?: AppHistoryNavigationType; | ||
canRespond?: boolean; | ||
userInitiated?: boolean; | ||
hashChange?: boolean; | ||
destination: AppHistoryDestination; | ||
signal: AbortSignal; | ||
formData?: FormData|null; | ||
info?: unknown; | ||
} | ||
|
||
declare class AppHistoryDestination { | ||
readonly url: string; | ||
readonly key: string|null; | ||
readonly id: string|null; | ||
readonly index: number; | ||
readonly sameDocument: boolean; | ||
|
||
getState(): unknown; | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.