Skip to content
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

feat: add navigationHistory.getEntryAtIndex(int index) method #41661

test: remove hardcoded url

93c00ad
Select commit
Failed to load commit list.
Merged

feat: add navigationHistory.getEntryAtIndex(int index) method #41661

test: remove hardcoded url
93c00ad
Select commit
Failed to load commit list.
Electron Archaeologist / Artifact Comparison completed Mar 27, 2024 in 58s

Changes Detected

Looks like the electron.d.ts file changed.

--- a/electron.old.d.ts
+++ b/electron.new.d.ts
@@ -6997,6 +6997,28 @@ declare namespace Electron {
     themeSource: ('system' | 'light' | 'dark');
   }
 
+  class NavigationHistory extends NodeEventEmitter {
+
+    // Docs: https://electronjs.org/docs/api/navigation-history
+
+    /**
+     * The index of the current page, from which we would go back/forward or reload.
+     */
+    getActiveIndex(): number;
+    /**
+     * * `url` string - The URL of the navigation entry at the given index.
+     * * `title` string - The page title of the navigation entry at the given index.
+     *
+     * If index is out of bounds (greater than history length or less than 0), null
+     * will be returned.
+     */
+    getEntryAtIndex(index: number): EntryAtIndex;
+    /**
+     * History length.
+     */
+    length(): number;
+  }
+
   interface Net {
 
     // Docs: https://electronjs.org/docs/api/net
@@ -14176,6 +14198,11 @@ declare namespace Electron {
      *
      */
     readonly mainFrame: WebFrameMain;
+    /**
+     * A `NavigationHistory` used by this webContents.
+     *
+     */
+    readonly navigationHistory: NavigationHistory;
     /**
      * A `WebFrameMain` property that represents the frame that opened this
      * WebContents, either with open(), or by navigating a link with a target
@@ -16617,6 +16644,17 @@ declare namespace Electron {
     uploadThroughput?: number;
   }
 
+  interface EntryAtIndex {
+    /**
+     * The URL of the navigation entry at the given index.
+     */
+    url: string;
+    /**
+     * The page title of the navigation entry at the given index.
+     */
+    title: string;
+  }
+
   interface FeedURLOptions {
     url: string;
     /**
@@ -19419,6 +19457,7 @@ declare namespace Electron {
     type DisplayMediaRequestHandlerHandlerRequest = Electron.DisplayMediaRequestHandlerHandlerRequest;
     type DownloadURLOptions = Electron.DownloadURLOptions;
     type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
+    type EntryAtIndex = Electron.EntryAtIndex;
     type FeedURLOptions = Electron.FeedURLOptions;
     type FileIconOptions = Electron.FileIconOptions;
     type FindInPageOptions = Electron.FindInPageOptions;
@@ -19655,6 +19694,7 @@ declare namespace Electron {
     type MessagePortMain = Electron.MessagePortMain;
     const nativeTheme: NativeTheme;
     type NativeTheme = Electron.NativeTheme;
+    type NavigationHistory = Electron.NavigationHistory;
     const net: Net;
     type Net = Electron.Net;
     const netLog: NetLog;
@@ -19747,6 +19787,7 @@ declare namespace Electron {
     type DisplayMediaRequestHandlerHandlerRequest = Electron.DisplayMediaRequestHandlerHandlerRequest;
     type DownloadURLOptions = Electron.DownloadURLOptions;
     type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
+    type EntryAtIndex = Electron.EntryAtIndex;
     type FeedURLOptions = Electron.FeedURLOptions;
     type FileIconOptions = Electron.FileIconOptions;
     type FindInPageOptions = Electron.FindInPageOptions;
@@ -20011,6 +20052,7 @@ declare namespace Electron {
     type DisplayMediaRequestHandlerHandlerRequest = Electron.DisplayMediaRequestHandlerHandlerRequest;
     type DownloadURLOptions = Electron.DownloadURLOptions;
     type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
+    type EntryAtIndex = Electron.EntryAtIndex;
     type FeedURLOptions = Electron.FeedURLOptions;
     type FileIconOptions = Electron.FileIconOptions;
     type FindInPageOptions = Electron.FindInPageOptions;
@@ -20270,6 +20312,7 @@ declare namespace Electron {
     type DisplayMediaRequestHandlerHandlerRequest = Electron.DisplayMediaRequestHandlerHandlerRequest;
     type DownloadURLOptions = Electron.DownloadURLOptions;
     type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
+    type EntryAtIndex = Electron.EntryAtIndex;
     type FeedURLOptions = Electron.FeedURLOptions;
     type FileIconOptions = Electron.FileIconOptions;
     type FindInPageOptions = Electron.FindInPageOptions;
@@ -20516,6 +20559,7 @@ declare namespace Electron {
     type NativeImage = Electron.NativeImage;
     const nativeTheme: NativeTheme;
     type NativeTheme = Electron.NativeTheme;
+    type NavigationHistory = Electron.NavigationHistory;
     const net: Net;
     type Net = Electron.Net;
     const netLog: NetLog;
@@ -20615,6 +20659,7 @@ declare namespace Electron {
     type DisplayMediaRequestHandlerHandlerRequest = Electron.DisplayMediaRequestHandlerHandlerRequest;
     type DownloadURLOptions = Electron.DownloadURLOptions;
     type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
+    type EntryAtIndex = Electron.EntryAtIndex;
     type FeedURLOptions = Electron.FeedURLOptions;
     type FileIconOptions = Electron.FileIconOptions;
     type FindInPageOptions = Electron.FindInPageOptions;