-
Notifications
You must be signed in to change notification settings - Fork 147
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
Consistent history access via gloo::history
#166
Comments
We should add this. This would also be beneficial for anyone writing a router for any framework/library. Where should this be added? Should this have it's own crate or be part of |
I think this should be in it's own crate. For the following reasons:
|
I see. Let's make a new |
Yes, I will file a PR. However, I am a little busy at the moment. I will put together a pull request when I have time. |
If you want, you can file a PR only with what's currently implemented. That will get the initial setup going and will subsequent PRs to be smaller |
Sounds like a plan. Currently, I will fix these edge cases properly before filing the PR and will limit initial PR to BrowserHistory and BrowserLocation. |
Great, I'm looking forward to it. Btw, you can file the PR as draft and and work on it to fix the edge cases |
Summary
Short overview of the proposal.
Motivation
Why are we doing this? What problems does it solve?
There's a JavaScript package
history
which provides a consistent API to access Session History in both browser and non-browser environment.This is currently implemented in
yew-router
, but I think it might be a better fit forgloo
. This issue proposes to upstream the history implementation togloo
.Detailed Explanation
There're 2 traits that will be introduced:
There're a couple flavours of
History
andLocation
:BrowserHistory
andBrowserLocation
(history managed viawindow.history.pushState
)HashHistory
andHashLocation
(history managed viawindow.history.pushState
, but path is stored inlocation.hash
)MemoryHistory
andMemoryLocation
(used in environment where Web API is not available)AnyHistory
andAnyLocation
(a enum that helps to access history and location when it's variant is not known.)Full Implementation: https://github.com/yewstack/yew/blob/master/packages/yew-router/src/history.rs
Drawbacks, Rationale, and Alternatives
Does this design have drawbacks? Are there alternative approaches? Why is this
design the best of all designs available?
This is a design that is familiar to anyone that have used browser's native history management API and is also used by
reacr-router
.What prior art exists? There are many good sources of inspiration: Ember, React,
Angular, Vue, Knockout, jQuery, Closure, Elm, Emscripten, ClojureScript,
Polymer, etc..
https://github.com/remix-run/history
Unresolved Questions
What is not clear yet? What do we expect to clarify through implementation
and/or usage experience?
The text was updated successfully, but these errors were encountered: