Simple router for ty web components using zipper-based tree structure
Simple router for ty web components using zipper-based tree structure
(authorized? component-id)Check if user can access component
Check if user can access component
(clj->query data)Convert clojure map to URLSearchParams string
Convert clojure map to URLSearchParams string
(component->location tree id)Find component by id in tree, return zipper location
Find component by id in tree, return zipper location
(component-path tree id)Build URL path from root to component, including hash fragment if present
Build URL path from root to component, including hash fragment if present
(component-tree-zipper root)Returns routing tree zipper
Returns routing tree zipper
(exact-match? tree current-url component-id)Compare current URL with component path, including hash fragments
Compare current URL with component path, including hash fragments
(get-current-url)Get current full URL including hash
Get current full URL including hash
(handle-landing!)Check if current location should trigger landing redirect. Always runs - redirects to best available route for 404s or auth failures.
Check if current location should trigger landing redirect. Always runs - redirects to best available route for 404s or auth failures.
(init!)(init! base)Initialize router with browser events and smart landing redirects
Initialize router with browser events and smart landing redirects
(landing-candidates)Get current landing candidates for debugging
Get current landing candidates for debugging
(link parent children)Add component(s) to router tree under parent. Parent should be a component id. Children can be a single component map or a vector of component maps.
Add component(s) to router tree under parent. Parent should be a component id. Children can be a single component map or a vector of component maps.
(maybe-add-base base url)For given base and url will add base prefix if it exists to url. If base is nil than URL is returned
For given base and url will add base prefix if it exists to url. If base is nil than URL is returned
(maybe-remove-base base url)For given base and url will return URL without base. If base is nil function will return URL immediately
For given base and url will return URL without base. If base is nil function will return URL immediately
(navigate! route-id)(navigate! route-id params)Navigate to a route by id with optional query params
Navigate to a route by id with optional query params
(on-path? tree path id)For given path and component id function will get component path and check if given path starts with component path.
If it does, than component is on path (true)
For given path and component id function will get component path and check if given path starts with component path. If it does, than component is on path (true)
(parse-url url)Parse URL into path and hash components
Parse URL into path and hash components
(query->clj qp)Convert URLSearchParams to clojure map
Convert URLSearchParams to clojure map
(query-params)Get current query parameters as a map
Get current query parameters as a map
(rendered? component-id)(rendered? component-id exact?)Check if component is on current path
Check if component is on current path
(set-component tree {:keys [id parent] :as component})Function used to add component to component tree. For given component tree add component by specifying component id and component parent.
Function used to add component to component tree. For given component tree add component by specifying component id and component parent.
(set-query! params)(set-query! params action)Set query parameters. Action can be :replace (default) or :push
Set query parameters. Action can be :replace (default) or :push
(update-router-from-browser! base)Update router state from current browser URL
Update router state from current browser URL
(url->components)(url->components url)(url->components tree url)Returns all components that are rendered for given URL
Returns all components that are rendered for given URL
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |