Liking cljdoc? Tell your friends :D

reitit.frontend.history

Provides integration to hash-change or HTML5 History events.

Provides integration to hash-change or HTML5 History
events.
raw docstring

Historycljsprotocol

-get-pathcljs

(-get-path this)

Get the current routing path, including query string and fragment

Get the current routing path, including query string and fragment

-hrefcljs

(-href this path)

Converts given routing path to browser location

Converts given routing path to browser location

-initcljs

(-init this)

Create event listeners

Create event listeners

-on-navigatecljs

(-on-navigate this path)

Find a match for current routing path and call on-navigate callback

Find a match for current routing path and call on-navigate callback

-stopcljs

(-stop this)

Remove event listeners

Remove event listeners
source

hrefcljs

(href history name)
(href history name path-params)
(href history name path-params query-params)
(href history 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.

Note: currently collections in query parameters are encoded as field-value pairs separated by &, i.e. "?a=1&a=2", if you want to encode them differently, convert the collections to strings first.

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.

Note: currently collections in query parameters are encoded as field-value
pairs separated by &, i.e. "?a=1&a=2", if you want to encode them
differently, convert the collections to strings first.
sourceraw docstring

ignore-anchor-click?cljs

(ignore-anchor-click? router e el uri)

Precicate to check if the anchor click event default action should be ignored. This logic will ignore the event if anchor href matches the route tree, and in this case the page location is updated using History API.

Precicate to check if the anchor click event default action
should be ignored. This logic will ignore the event
if anchor href matches the route tree, and in this case
the page location is updated using History API.
sourceraw docstring

(navigate history name)
(navigate history
          name
          {:keys [path-params query-params fragment replace] :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.

Note: currently collections in query-parameters are encoded as field-value pairs separated by &, i.e. "?a=1&a=2", if you want to encode them differently, convert the collections to strings first.

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.

Note: currently collections in query-parameters are encoded as field-value
pairs separated by &, i.e. "?a=1&a=2", if you want to encode them
differently, convert the collections to strings first.

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 history name)
(push-state history name path-params)
(push-state history name path-params query-params)
(push-state history name path-params query-params fragment)

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

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

Note: currently collections in query-parameters are encoded as field-value pairs separated by &, i.e. "?a=1&a=2", if you want to encode them differently, convert the collections to strings first.

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

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

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

Note: currently collections in query-parameters are encoded as field-value
pairs separated by &, i.e. "?a=1&a=2", if you want to encode them
differently, convert the collections to strings first.

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

replace-statecljs

(replace-state history name)
(replace-state history name path-params)
(replace-state history name path-params query-params)
(replace-state history 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.

Note: currently collections in query-parameters are encoded as field-value pairs separated by &, i.e. "?a=1&a=2", if you want to encode them differently, convert the collections to strings first.

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.

Note: currently collections in query-parameters are encoded as field-value
pairs separated by &, i.e. "?a=1&a=2", if you want to encode them
differently, convert the collections to strings first.

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

set-querycljs

(set-query history new-query-or-update-fn)
(set-query history 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.

Note: The query parameter values aren't coereced, so the update fn will see string values for all query params.

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.

Note: The query parameter values aren't coereced, so the
update fn will see string values for all query params.
sourceraw docstring

start!cljs

(start! router on-navigate)
(start! router
        on-navigate
        {:keys [use-fragment] :or {use-fragment true} :as opts})

This registers event listeners on HTML5 history and hashchange events.

Returns History object.

When using with development workflow like Figwheel, remember to remove listeners using stop! call before calling start! again.

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.

Returns History object.

When using with development workflow like Figwheel, remember to
remove listeners using stop! call before calling start! again.

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

stop!cljs

(stop! history)

Stops the given history handler, removing the event handlers.

Stops the given history handler, removing the event handlers.
sourceraw docstring

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

× close