Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
21 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/* / 200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,11 @@ | ||
(ns spa-routing.routes | ||
(:require-macros [secretary.core :refer [defroute]]) | ||
(:import goog.History) | ||
(:require [secretary.core :as secretary] | ||
[goog.events :as events] | ||
[goog.history.EventType :as EventType] | ||
[re-frame.core :as re-frame])) | ||
(:require | ||
[bidi.bidi :as bidi])) | ||
|
||
(defn hook-browser-navigation! [] | ||
(doto (History.) | ||
(events/listen | ||
EventType/NAVIGATE | ||
(fn [event] | ||
(secretary/dispatch! (.-token event)))) | ||
(.setEnabled true))) | ||
(def routes | ||
["/" {"" :home-panel | ||
"about" :about-panel}]) | ||
|
||
(defn app-routes [] | ||
(secretary/set-config! :prefix "#") | ||
;; -------------------- | ||
;; define routes here | ||
(defroute "/" [] | ||
(re-frame/dispatch [:set-active-panel :home-panel])) | ||
(def match (partial bidi/match-route routes)) | ||
|
||
(defroute "/about" [] | ||
(re-frame/dispatch [:set-active-panel :about-panel])) | ||
|
||
|
||
;; -------------------- | ||
(hook-browser-navigation!)) | ||
(def path (partial bidi/path-for routes)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters