Utilities for client side routing, i.e. multiple pages in a so called single page application.
The basic usage is to define routes and page functions, and the use a router component near the toplevel of your application to show different contents based on the current browser location URL:
(routes/defroutes my-app
(routes/defroute home "/"))
(html5-history-router {home (constantly "Hello World")})
Utilities for client side routing, i.e. multiple pages in a so called single page application. The basic usage is to define routes and page functions, and the use a router component near the toplevel of your application to show different contents based on the current browser location URL: ``` (routes/defroutes my-app (routes/defroute home "/")) (html5-history-router {home (constantly "Hello World")}) ```
(goto path)
Returns an action that causes the browser to go to the given path. Must be emitted from an item below a history-router item.
Returns an action that causes the browser to go to the given path. Must be emitted from an item below a history-router item.
(href route & params)
Return an url string for the given route, with arguments for the positional and maybe a map for query params as required by the given route. Note that this is the same as calling the route as a function.
Return an url string for the given route, with arguments for the positional and maybe a map for query params as required by the given route. Note that this is the same as calling the route as a function.
(html5-history-router pages-map)
An item that renders to one of the pages from the given map of
routes to pages, depending on the current browser location, which is
monitored for changes. It also handles goto
actions emitted from
within, modifying the browser history accordingly. A page must be a
function taking the arguments of the route, returning an item.
An item that renders to one of the pages from the given map of routes to pages, depending on the current browser location, which is monitored for changes. It also handles [[goto]] actions emitted from within, modifying the browser history accordingly. A page must be a function taking the arguments of the route, returning an item.
(router pages-map)
An item that renders to one of the pages from the given map of
routes to pages, depending on the pathname and query of the current
window location URI. Unlike html5-history-router
this does not
capture/monitor location changes, but it handles goto
actions.
An item that renders to one of the pages from the given map of routes to pages, depending on the pathname and query of the current window location URI. Unlike [[html5-history-router]] this does not capture/monitor location changes, but it handles [[goto]] actions.
(unload-confirmation & [disabled])
While this subscription is
active, the browser shall warn the user about losing data if they
leave the page, offering to stay on the page instead. If disabled
is
true, this does nothing.
While this subscription is active, the browser shall warn the user about losing data if they leave the page, offering to stay on the page instead. If `disabled` is true, this does nothing.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close