mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 09:57:35 +00:00
LibWeb: Implement the start of the Navigation API
This API is how JavaScript can manipulate the new Navigable concepts directly. We are still missing most of the interesting algorithms on Navigation that do the actual navigation steps, and call into the currently WIP navigable AOs.
This commit is contained in:
parent
51c2835044
commit
0c2f758067
9 changed files with 378 additions and 0 deletions
56
Userland/Libraries/LibWeb/HTML/Navigation.idl
Normal file
56
Userland/Libraries/LibWeb/HTML/Navigation.idl
Normal file
|
@ -0,0 +1,56 @@
|
|||
#import <DOM/EventHandler.idl>
|
||||
#import <DOM/EventTarget.idl>
|
||||
#import <HTML/NavigationHistoryEntry.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#navigation-interface
|
||||
[Exposed=Window]
|
||||
interface Navigation : EventTarget {
|
||||
sequence<NavigationHistoryEntry> entries();
|
||||
readonly attribute NavigationHistoryEntry? currentEntry;
|
||||
undefined updateCurrentEntry(NavigationUpdateCurrentEntryOptions options);
|
||||
// FIXME: readonly attribute NavigationTransition? transition;
|
||||
|
||||
readonly attribute boolean canGoBack;
|
||||
readonly attribute boolean canGoForward;
|
||||
|
||||
// TODO: Actually implement navigation algorithms
|
||||
// NavigationResult navigate(USVString url, optional NavigationNavigateOptions options = {});
|
||||
// NavigationResult reload(optional NavigationReloadOptions options = {});
|
||||
|
||||
// NavigationResult traverseTo(DOMString key, optional NavigationOptions options = {});
|
||||
// NavigationResult back(optional NavigationOptions options = {});
|
||||
// NavigationResult forward(optional NavigationOptions options = {});
|
||||
|
||||
attribute EventHandler onnavigate;
|
||||
attribute EventHandler onnavigatesuccess;
|
||||
attribute EventHandler onnavigateerror;
|
||||
attribute EventHandler oncurrententrychange;
|
||||
};
|
||||
|
||||
dictionary NavigationUpdateCurrentEntryOptions {
|
||||
required any state;
|
||||
};
|
||||
|
||||
dictionary NavigationOptions {
|
||||
any info;
|
||||
};
|
||||
|
||||
dictionary NavigationNavigateOptions : NavigationOptions {
|
||||
any state;
|
||||
NavigationHistoryBehavior history = "auto";
|
||||
};
|
||||
|
||||
dictionary NavigationReloadOptions : NavigationOptions {
|
||||
any state;
|
||||
};
|
||||
|
||||
dictionary NavigationResult {
|
||||
Promise<NavigationHistoryEntry> committed;
|
||||
Promise<NavigationHistoryEntry> finished;
|
||||
};
|
||||
|
||||
enum NavigationHistoryBehavior {
|
||||
"auto",
|
||||
"push",
|
||||
"replace"
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue