-
Notifications
You must be signed in to change notification settings - Fork 16.9k
feat: duplicate navigation related APIs to contents.navigationHistory
#41752
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: duplicate navigation related APIs to contents.navigationHistory
#41752
Conversation
contents.navigationHistorycontents.navigationHistory
contents.navigationHistorycontents.navigationHistory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codewise this looks great to me - the only outstanding question here is what (if any) timeline we'd want to consider targeting for deprecation of the old methods. Our options I would say are:
- Merge this as is and support both for the medium-term future, deprecating the old approach in a handful of versions and removing a few after that
- Deprecate now to indicate that developers should look to use the new code where possible but leave in for a good long time, no specific removal date
- Deprecate and remove in the next few targeted cycles
My personal approach would probably be #2 but I think any are reasonably justifiable. I do think we should decided on one before merging though! Thoughts (cc @MarshallOfSound)?
|
I'd be in favor of adding deprecation warnings now (2) as to give developers and library authors the most time to migrate. |
|
Thanks for the feedback! @codebytere @samuelmaddock I updated the PR with In the future, when we are ready to officially deprecate, I can:
Let me know if there is anything else I can do for deprecation warnings for this PR! |
5a21c21 to
8bfebec
Compare
codebytere
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alicelovescake sorry for the delay here - in addition to adding deprecation notes to docs, we'll also want to leverage our internal deprecate module to notify developers at run-time as well:
deprecate.warnOnce('webContents.canGoToOffset', 'webContents.navigationHistory.canGoToOffset');3a3556a to
5e931eb
Compare
Thanks for the code pointer! Added the warnings by:
|
codebytere
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API LGTM
samuelmaddock
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API LGTM
Co-authored-by: Sam Maddock <[email protected]>
Co-authored-by: Sam Maddock <[email protected]>
Co-authored-by: Sam Maddock <[email protected]>
Co-authored-by: Sam Maddock <[email protected]>
erickzhao
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs: lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving on behalf of the Electron Docs Team
|
Release Notes Persisted
|

Description of Change
This PR refactors and duplicates navigation related APIs to
contents.navigationHistory. Follow up to previous PR #41577 where a new navigationHistory property is created on web contents.This PR duplicates and exposes the following API for consistency and clarity:
canGoBackgoBackcanGoForwardgoForwardcanGoToOffsetgoToOffsetclearAdded related tests and documentation.
For backwards compatibility, the above APIs can still be directly accessed from webContents.
Checklist
npm testpassesRelease Notes
Notes: Added the following existing navigation related APIs to
webcontents.navigationHistory:canGoBack,goBack,canGoForward,goForward,canGoToOffset,goToOffset,clear