Liking cljdoc? Tell your friends :D

ty.router

Simple router for ty web components using zipper-based tree structure

Simple router for ty web components using zipper-based tree structure
raw docstring

*permissions*cljs

source

*roles*cljs

source

*router*cljs

source

*user*cljs

source

authorized?cljs

(authorized? component-id)

Check if user can access component

Check if user can access component
sourceraw docstring

clj->querycljs

(clj->query data)

Convert clojure map to URLSearchParams string

Convert clojure map to URLSearchParams string
sourceraw docstring

component->locationcljs

(component->location tree id)

Find component by id in tree, return zipper location

Find component by id in tree, return zipper location
sourceraw docstring

component-pathcljs

(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
sourceraw docstring

component-tree-zippercljs

(component-tree-zipper root)

Returns routing tree zipper

Returns routing tree zipper
sourceraw docstring

exact-match?cljs

(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
sourceraw docstring

get-current-urlcljs

(get-current-url)

Get current full URL including hash

Get current full URL including hash
sourceraw docstring

handle-landing!cljs

(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.
sourceraw docstring

init!cljs

(init!)
(init! base)

Initialize router with browser events and smart landing redirects

Initialize router with browser events and smart landing redirects
sourceraw docstring

landing-candidatescljs

(landing-candidates)

Get current landing candidates for debugging

Get current landing candidates for debugging
sourceraw docstring

(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.
sourceraw docstring

maybe-add-basecljs

(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
sourceraw docstring

maybe-remove-basecljs

(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
sourceraw docstring

(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
sourceraw docstring

on-path?cljs

(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)
sourceraw docstring

parse-urlcljs

(parse-url url)

Parse URL into path and hash components

Parse URL into path and hash components
sourceraw docstring

query->cljcljs

(query->clj qp)

Convert URLSearchParams to clojure map

Convert URLSearchParams to clojure map
sourceraw docstring

query-paramscljs

(query-params)

Get current query parameters as a map

Get current query parameters as a map
sourceraw docstring

rendered?cljs

(rendered? component-id)
(rendered? component-id exact?)

Check if component is on current path

Check if component is on current path
sourceraw docstring

set-componentcljs

(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.
sourceraw docstring

set-query!cljs

(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
sourceraw docstring

update-router-from-browser!cljs

(update-router-from-browser! base)

Update router state from current browser URL

Update router state from current browser URL
sourceraw docstring

url->componentscljs

(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
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close