The router API should allow its backend to be configurable #2942
dead-claudia
started this conversation in
Ideas
Replies: 1 comment
-
If I find time, I'll implement this. It's pretty straightforward. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
It should be possible to configure how URLs are routed, so people aren't having to fork it for use cases like this. For comparison, it'd give us the ability to provide a hook like React Router's
history
attribute, without much work on our part.(It's come up on Gitter more than once. Marking for v2 because it's a pretty trivial change on our part.)
Here's what I propose:
$window
directly for the core router, accept a backend, and default to one that wraps$window
. Same goes for the API frontend.backend.normalize(fragment)
- Get and normalize the specified fragment.backend.setPath(prefix, path, state, title, replace)
- Set the path given certain optionsbackend.initialState()
- Get the initial state to potentially assign.backend.registerResolver(resolver)
- Register the router'sresolveRoutes
function.Basically, I don't want to require every user that needs to override the underlying routing mechanism to redo the entire router, but instead just require them to implement a few methods.
Beta Was this translation helpful? Give feedback.
All reactions