Liking cljdoc? Tell your friends :D

reitit.frontend.easy

Easy wrapper over reitit.frontend.history, handling the state. Only one router can be active at a time.

Easy wrapper over reitit.frontend.history,
handling the state. Only one router can be active
at a time.
raw docstring

historycljs

source

hrefcljs

(href name)
(href name path-params)
(href name path-params query-params)
(href name path-params query-params fragment)

Generate a URL for a route defined by name, with given path-params and query-params.

The URL is formatted using Reitit frontend history handler, so using it with anchor element href will correctly trigger route change event.

By default currently collections in query parameters are encoded as field-value pairs separated by &, i.e. "?a=1&a=2". To encode them differently, you can either use Malli coercion to encode values, or just turn the values to strings before calling the function.

Generate a URL for a route defined by name, with given path-params and query-params.

The URL is formatted using Reitit frontend history handler, so using it with
anchor element href will correctly trigger route change event.

By default currently collections in query parameters are encoded as field-value
pairs separated by &, i.e. "?a=1&a=2". To encode them differently, you can
either use Malli coercion to encode values, or just turn the values to strings
before calling the function.
sourceraw docstring

(navigate name)
(navigate name {:keys [path-params query-params replace fragment] :as opts})

Updates the browser location and either pushes new entry to the history stack or replaces the latest entry in the the history stack (controlled by replace option) using URL built from a route defined by name given parameters.

Will also trigger on-navigate callback on Reitit frontend History handler.

By default currently collections in query parameters are encoded as field-value pairs separated by &, i.e. "?a=1&a=2". To encode them differently, you can either use Malli coercion to encode values, or just turn the values to strings before calling the function.

See also: https://developer.mozilla.org/en-US/docs/Web/API/History/pushState https://developer.mozilla.org/en-US/docs/Web/API/History/replaceState

Updates the browser location and either pushes new entry to the history stack
or replaces the latest entry in the the history stack (controlled by
`replace` option) using URL built from a route defined by name given
parameters.

Will also trigger on-navigate callback on Reitit frontend History handler.

By default currently collections in query parameters are encoded as field-value
pairs separated by &, i.e. "?a=1&a=2". To encode them differently, you can
either use Malli coercion to encode values, or just turn the values to strings
before calling the function.

See also:
https://developer.mozilla.org/en-US/docs/Web/API/History/pushState
https://developer.mozilla.org/en-US/docs/Web/API/History/replaceState
sourceraw docstring

push-statecljs

(push-state name)
(push-state name path-params)
(push-state name path-params query-params)
(push-state name path-params query-params fragment)

Updates the browser location and pushes new entry to the history stack using URL built from a route defined by name, with given path-params and query-params.

Will also trigger on-navigate callback on Reitit frontend History handler.

By default currently collections in query parameters are encoded as field-value pairs separated by &, i.e. "?a=1&a=2". To encode them differently, you can either use Malli coercion to encode values, or just turn the values to strings before calling the function.

See also: https://developer.mozilla.org/en-US/docs/Web/API/History/pushState

Updates the browser location and pushes new entry to the history stack using
URL built from a route defined by name, with given path-params and
query-params.

Will also trigger on-navigate callback on Reitit frontend History handler.

By default currently collections in query parameters are encoded as field-value
pairs separated by &, i.e. "?a=1&a=2". To encode them differently, you can
either use Malli coercion to encode values, or just turn the values to strings
before calling the function.

See also:
https://developer.mozilla.org/en-US/docs/Web/API/History/pushState
sourceraw docstring

replace-statecljs

(replace-state name)
(replace-state name path-params)
(replace-state name path-params query-params)
(replace-state name path-params query-params fragment)

Updates the browser location and replaces latest entry in the history stack using URL built from a route defined by name, with given path-params and query-params.

Will also trigger on-navigate callback on Reitit frontend History handler.

By default currently collections in query parameters are encoded as field-value pairs separated by &, i.e. "?a=1&a=2". To encode them differently, you can either use Malli coercion to encode values, or just turn the values to strings before calling the function.

See also: https://developer.mozilla.org/en-US/docs/Web/API/History/replaceState

Updates the browser location and replaces latest entry in the history stack
using URL built from a route defined by name, with given path-params and
query-params.

Will also trigger on-navigate callback on Reitit frontend History handler.

By default currently collections in query parameters are encoded as field-value
pairs separated by &, i.e. "?a=1&a=2". To encode them differently, you can
either use Malli coercion to encode values, or just turn the values to strings
before calling the function.

See also:
https://developer.mozilla.org/en-US/docs/Web/API/History/replaceState
sourceraw docstring

set-querycljs

(set-query new-query-or-update-fn)
(set-query new-query-or-update-fn {:keys [replace] :as opts})

Update query parameters for the current route.

New query params can be given as a map, or a function taking the old params and returning the new modified params.

The current path is matched against the routing tree, and the match data (schema, coercion) is used to encode the query parameters. If the current path doesn't match any route, the query parameters are parsed from the path without coercion and new values are also stored without coercion encoding.

Update query parameters for the current route.

New query params can be given as a map, or a function taking
the old params and returning the new modified params.

The current path is matched against the routing tree, and the match data
(schema, coercion) is used to encode the query parameters.
If the current path doesn't match any route, the query parameters
are parsed from the path without coercion and new values
are also stored without coercion encoding.
sourceraw docstring

start!cljs

(start! router on-navigate opts)

This registers event listeners on HTML5 history and hashchange events.

Automatically removes previous event listeners so it is safe to call this repeatedly, for example when using Figwheel or similar development workflow.

Parameters:

  • router The Reitit router.
  • on-navigate Function to be called when route changes. Takes two parameters, ´match´ and ´history´ object.

Options:

  • :use-fragment (default true) If true, onhashchange and location hash are used to store current route.

Options (Html5History):

  • :ignore-anchor-click? Function (router, event, anchor element, uri) which will be called to check if the anchor click event should be ignored. To extend built-in check, you can call reitit.frontend.history/ignore-anchor-click? function, which will ignore clicks if the href matches route tree.
This registers event listeners on HTML5 history and hashchange events.

Automatically removes previous event listeners so it is safe to call this repeatedly, for example when using
Figwheel or similar development workflow.

Parameters:
- router         The Reitit router.
- on-navigate    Function to be called when route changes. Takes two parameters, ´match´ and ´history´ object.

Options:
- :use-fragment  (default true) If true, onhashchange and location hash are used to store current route.

Options (Html5History):
- :ignore-anchor-click?  Function (router, event, anchor element, uri) which will be called to
                         check if the anchor click event should be ignored.
                         To extend built-in check, you can call `reitit.frontend.history/ignore-anchor-click?`
                         function, which will ignore clicks if the href matches route tree.
sourceraw docstring

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

× close