An implementation of RAD's RouteHistory protocol, wrapping a browser's location and History API. This implementation will put an string-valued route parameters onto the query parameter section of the URI when a route is pushed or replaced, and will merge the current URL's query parameters with returned route params.
An implementation of RAD's RouteHistory protocol, wrapping a browser's location and History API. This implementation will put an string-valued route parameters onto the query parameter section of the URI when a route is pushed or replaced, and will merge the current URL's query parameters with returned route params.
(apply-route! app {:keys [route params] :as saved-route})
Apply the given route and params to the URL and routing system. saved-route
is in the format of
the return value of url->route
. Returns true if it is able to route there.
Apply the given route and params to the URL and routing system. `saved-route` is in the format of the return value of `url->route`. Returns true if it is able to route there.
(decode-uri-component v)
Decode the given string as a transit and URI encoded CLJ(s) value.
Decode the given string as a transit and URI encoded CLJ(s) value.
(encode-uri-component v)
Encode a key/value pair of CLJ(s) data such that it can be safely placed in browser query params. If v
is
a plain string, then it will not be transit-encoded.
Encode a key/value pair of CLJ(s) data such that it can be safely placed in browser query params. If `v` is a plain string, then it will not be transit-encoded.
(html5-history)
Create a new instance of a RouteHistory object that is properly configured against the browser's HTML5 History API.
Create a new instance of a RouteHistory object that is properly configured against the browser's HTML5 History API.
(query-string param-map & {:as string-key-values})
Convert a map to an encoded string that is acceptable on a URL. The param-map allows any data type acceptable to transit. The additional key-values must all be strings (and will be coerced to string if not).
Convert a map to an encoded string that is acceptable on a URL. The param-map allows any data type acceptable to transit. The additional key-values must all be strings (and will be coerced to string if not).
(restore-route! app default-page default-params)
Attempt to restore the route given in the URL. If that fails, simply route to the default given (a class and map).
WARNING: This should not be called until the HTML5 history is installed in your app.
Attempt to restore the route given in the URL. If that fails, simply route to the default given (a class and map). WARNING: This should not be called until the HTML5 history is installed in your app.
(url->route)
Convert the current browser URL into a route path and parameter map. Returns:
{:route ["path" "segment"]
:params {:param value}}
You can save this value and later use it with apply-route!
.
Convert the current browser URL into a route path and parameter map. Returns: ``` {:route ["path" "segment"] :params {:param value}} ``` You can save this value and later use it with `apply-route!`.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close