(format-route route params)
Takes a route spec map and map of params, returns formatted URI path
Takes a route spec map and map of params, returns formatted URI path
(format-route-for-id routes id args)
Composition of route-for-id and format-route.
Composition of route-for-id and format-route.
(get-hash-route)
(html5-history frag?)
(localhost?)
(replace-route! routes id params)
(route-for-id routes id)
Takes vector of routes and route id to find, returns route spec.
Takes vector of routes and route id to find, returns route spec.
(set-hash-route! routes id params)
(set-location! url)
(start! {:keys [history routes init default dispatch auth]})
Takes a map of following keys, configures and attaches router to given history object:
:history - goog.Html5History instance
:routes - vector of route specs
:init - init URI path
:default - default route spec
:dispatch - user nav change handler fn
:auth - user auth fn
init URI can be used to force a certain entry route (default nil)
handler fn is called on nav change with matched route spec
auth fn also called with single route spec during matching and can be used to restrict access to routes (e.g. if user not logged in etc.). Only called for routes with :auth key enabled and must return truthy value for route to succeed
Takes a map of following keys, configures and attaches router to given history object: - :history - goog.Html5History instance - :routes - vector of route specs - :init - init URI path - :default - default route spec - :dispatch - user nav change handler fn - :auth - user auth fn - init URI can be used to force a certain entry route (default nil) - handler fn is called on nav change with matched route spec - auth fn also called with single route spec during matching and can be used to restrict access to routes (e.g. if user not logged in etc.). Only called for routes with :auth key enabled and must return truthy value for route to succeed
(trigger! history uri)
Takes URI path and sets as history token.
Takes URI path and sets as history token.
(virtual-link history uri)
Helper :on-click handler for internal SPA links. Calls preventDefault on event and calls trigger with given URI path.
Helper :on-click handler for internal SPA links. Calls preventDefault on event and calls trigger with given URI path.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close