(set-location! _ location)
(replace-location! _ location)
(start-router! routes
{:keys [on-navigate default-location]
:or {on-navigate (constantly nil)}})
Starts up a Bidi router based on Google Closure's 'History'
Types:
Location :- {:handler ... :route-params {...}}
Parameters:
routes :- a Bidi route structure on-navigate :- 0-arg function, accepting a Location default-location :- Location to default to if the current token doesn't match a route
Returns :- Router
Example usage:
(require '[bidi.router :as br])
(let [!location (atom nil) router (br/start-router! ["" {"/" ::home-page "/page2" ::page2}] {:on-navigate (fn [location] (reset! !location location)) :default-location {:handler ::home-page}})]
...
(br/set-location! router {:handler ::page2}))
Starts up a Bidi router based on Google Closure's 'History' Types: Location :- {:handler ... :route-params {...}} Parameters: routes :- a Bidi route structure on-navigate :- 0-arg function, accepting a Location default-location :- Location to default to if the current token doesn't match a route Returns :- Router Example usage: (require '[bidi.router :as br]) (let [!location (atom nil) router (br/start-router! ["" {"/" ::home-page "/page2" ::page2}] {:on-navigate (fn [location] (reset! !location location)) :default-location {:handler ::home-page}})] ... (br/set-location! router {:handler ::page2}))
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close