Repository navigation
feat: duplicate navigation related APIs to contents.navigationHistory - #41752
Conversation
contents.navigationHistorycontents.navigationHistory
contents.navigationHistorycontents.navigationHistory
There was a problem hiding this comment.
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)?
|
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.
@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:
|
Co-authored-by: Sam Maddock <samuel.maddock@gmail.com>
Co-authored-by: Sam Maddock <samuel.maddock@gmail.com>
Co-authored-by: Sam Maddock <samuel.maddock@gmail.com>
Co-authored-by: Sam Maddock <samuel.maddock@gmail.com>


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