Liking cljdoc? Tell your friends :D

benefactor.route


format-query-stringcljs

(format-query-string params)

Given a map of params, returns the query string to be appended on the path.

Given a map of params, returns the query string to be appended on the path.
sourceraw docstring

get-query-stringcljs

(get-query-string route)

Given a path, returns the query string when one is present.

Given a path, returns the query string when one is present.
sourceraw docstring

hash->pathcljs

(hash->path token)

Given a hash in the format "#!/xxx" returns the path "/xxx"

Given a hash in the format "#!/xxx" returns the path "/xxx"
sourceraw docstring

hash-routercljs

(hash-router navigate-callback)

Given a callback to be called with the event on Navigate returns a History instance. You can then use (.setToken (hash-router callback)) to change the hash. Changing the hash will trigger the navigate-callback. Docs: https://google.github.io/closure-library/api/goog.history.Event.html

Given a callback to be called with the event on Navigate returns a History
instance. You can then use (.setToken (hash-router callback)) to change the
hash. Changing the hash will trigger the navigate-callback. Docs:
https://google.github.io/closure-library/api/goog.history.Event.html
sourceraw docstring

(navigate! router bidi-routes route-name)
(navigate! router bidi-routes route-name params)
(navigate! router bidi-routes route-name params error-callback)

Given a router, bidi-routes, route-name and optional params and optional error-callback, navigate to a route when possible. Navigate to empty hash otherwise, or if provided a callback navigate to the return value of the callback function. Check the route->path function docs about the callback arguments. E.g.: (go! app-route :sample {:id 6})

Given a router, bidi-routes, route-name and optional params and optional
error-callback, navigate to a route when possible. Navigate to empty hash
otherwise, or if provided a callback navigate to the return value of the
callback function. Check the route->path function docs about the callback
arguments.  E.g.: `(go! app-route :sample {:id 6})`
sourceraw docstring

(navigate-event->token event)

Given a navigate event (goog.History/EventType.NAVIGATE) returns the hash token without the #. E.g.: if the route is "http://exemple.com/#!/profile" when the event is triggered it will return "!/profile"

Given a navigate event (goog.History/EventType.NAVIGATE) returns the hash
token without the `#`. E.g.: if the route is
"http://exemple.com/#!/profile" when the event is triggered it will return
"!/profile"
sourceraw docstring

parse-query-stringcljs

(parse-query-string query-string)

Given a query string returns a map of params.

Given a query string returns a map of params.
sourceraw docstring

path->hashcljs

(path->hash path)

Given a path "/xxx" retuns a hash to be used in links "#!/xxx"

Given a path "/xxx" retuns a hash to be used in links "#!/xxx"
sourceraw docstring

path->routecljs

(path->route bidi-routes path)

Given a path "/foo" returns the matched route or nil.

Given a path "/foo" returns the matched route or nil.
sourceraw docstring

path->tokencljs

(path->token path)

Given a path "/xxx" retuns a token to be used by .setToken "!/xxx"

Given a path "/xxx" retuns a token to be used by .setToken "!/xxx"
sourceraw docstring

path-forcljs

(path-for route handler)
(path-for route handler params)

Given a route definition data structure, a handler and an params map, return a path that would route to the handler. The map must contain the values to any parameters required to create the path, and extra values are silently ignored. It's like bidi/path-for but with an map as params argument instead of key value pairs. It also adds a query-string when there is a :query-params key inside params.

Given a route definition data structure, a handler and an params map, return
a path that would route to the handler. The map must contain the values to
any parameters required to create the path, and extra values are silently
ignored. It's like bidi/path-for but with an map as params argument instead
of key value pairs. It also adds a query-string when there is a :query-params
key inside params.
sourceraw docstring

route->pathcljs

(route->path bidi-routes route-name)
(route->path bidi-routes route-name params)
(route->path bidi-routes route-name params error-callback)

Given bidi-routes, route-name and optional parameters and optional error-callback, creates a link to the route-name when possible. Create a link to empty hash otherwise. E.g.: (route->path [[["/sample/" [long :id]]] :sample] :sample {:id 5}) returns "/sample/5" The default error-callback is called with a map containing a key args with the route-name and params and a key error with the expection and prints the map and returns "#!/"

Given bidi-routes, route-name and optional parameters and optional
error-callback, creates a link to the route-name when possible. Create a link
to empty hash otherwise.  E.g.:
(route->path [[["/sample/" [long :id]]] :sample] :sample {:id 5})
returns "/sample/5" The default error-callback is called with a map
containing a key args with the route-name and params and a key error with the
expection and prints the map and returns "#!/"
sourceraw docstring

setup-routercljs

(setup-router bidi-routes f)
(setup-router bidi-routes f f-error)

Given bidi-routes, f and optional f-error add a listener to update routes. When the route change, if the route matches f is called with a vector of [path parsed-route], else f-error is called on the current path, returns the router.

Given bidi-routes, f and optional f-error  add a listener to update routes.
When the route change, if the route matches f is called with a vector of
[path parsed-route], else f-error is called on the current path, returns the
router.
sourceraw docstring

split-parameterscljs

(split-parameters param)
source

sync-from-atomcljs

(sync-from-atom router path-atom)

Given a router and a atom containing the current path setups a watch that will update the hash when the atom content changes to a different path.

Given a router and a atom containing the current path setups a watch that
will update the hash when the atom content changes to a different path.
sourceraw docstring

token->pathcljs

(token->path token)

Given a token in the format "!/xxx" returns the path "/xxx"

Given a token in the format "!/xxx" returns the path "/xxx"
sourceraw docstring

url-decodecljs

(url-decode string)
source

url-encodecljs

(url-encode string)
source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close