Closed amitaibu closed 8 years ago
(updated title)
I took a quick look at this, and it turns out that it will be a little more complex than I realized.
At the moment, elm-history provides access to window.location.pathname
and window.location.hash
, but not window.location.search
. So, given a URL like:
http://www.apple.com/some/path?query=7#anchor
... elm-history will give us access to "/some/path" and "#anchor", but nothing else.
If https://github.com/elm-lang/package.elm-lang.org/pull/124 gets accepted, then I can enhance elm-history so that it provides access to window.location.search
etc. Otherwise, we won't be able to do it without using native code here.
ping. Are you still in elm-land ? :)
Ah, indeed, here I am!
I have been a little distracted, but there has been progress in elm-history, as @liamcurry has contributed some code to get the full href in a signal.
Though, now that I think about it some more, we'll actually need some code to set the full href as well, or at least as much of it as the HTML5 API allows. But that isn't hard -- I'll write something up for that now.
Once that's done, I need to re-architect elm-route-hash a little so that the current method of parsing is just one option -- so people can get and set full URLs.
I'm not sure what I was thinking ... the History module will already allow us to write the query string via setPath
or replacePath
. So, that's all in place ... I just need to modify elm-route-hash to use it.
:+1:
This will be implemented for elm-route-hash 2.0, for Elm 0.17.
This is now available in the published version 2.0.0 of elm-route-url.
Sometimes it makes more sense to have query strings mapped to the actions instead of actual arguments (e.g. when filtering search using faceted search)