feat: duplicate navigation related APIs to contents.navigationHistory (#41752)

* refactor: move navigation related api to navigationHistory

* docs: add deprecation messages to old web content methods

* fix: add deprecation warnings to webcontents

* fix: add deprecation warnings and make existing naviagation apis internal

* Update docs/api/web-contents.md

Co-authored-by: Sam Maddock <samuel.maddock@gmail.com>

* Update docs/api/web-contents.md

Co-authored-by: Sam Maddock <samuel.maddock@gmail.com>

* Update docs/api/web-contents.md

Co-authored-by: Sam Maddock <samuel.maddock@gmail.com>

* Update docs/api/web-contents.md

Co-authored-by: Sam Maddock <samuel.maddock@gmail.com>

* docs: fix links

* docs: add breaking change to 31

* docs: move breaking change to 32

* chore: re-run pipeline

---------

Co-authored-by: Sam Maddock <samuel.maddock@gmail.com>
This commit is contained in:
Alice Zhao 2024-06-05 09:34:47 -07:00 committed by GitHub
parent 5fb117a7d7
commit 406f644d26
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 239 additions and 17 deletions

View file

@ -9,6 +9,24 @@ Each navigation entry corresponds to a specific page. The indexing system follow
### Instance Methods
#### `navigationHistory.canGoBack()`
Returns `boolean` - Whether the browser can go back to previous web page.
#### `navigationHistory.canGoForward()`
Returns `boolean` - Whether the browser can go forward to next web page.
#### `navigationHistory.canGoToOffset(offset)`
* `offset` Integer
Returns `boolean` - Whether the web page can go to the specified `offset` from the current entry.
#### `navigationHistory.clear()`
Clears the navigation history.
#### `navigationHistory.getActiveIndex()`
Returns `Integer` - The index of the current page, from which we would go back/forward or reload.
@ -24,6 +42,26 @@ Returns `Object`:
If index is out of bounds (greater than history length or less than 0), null will be returned.
#### `navigationHistory.goBack()`
Makes the browser go back a web page.
#### `navigationHistory.goForward()`
Makes the browser go forward a web page.
#### `navigationHistory.goToIndex(index)`
* `index` Integer
Navigates browser to the specified absolute web page index.
#### `navigationHistory.goToOffset(offset)`
* `offset` Integer
Navigates to the specified offset from the current entry.
#### `navigationHistory.length()`
Returns `Integer` - History length.