From 2cfd616dd277fc11c63d6aef31849dd31678b796 Mon Sep 17 00:00:00 2001 From: Dan Holmsand Date: Sun, 30 Nov 2014 16:40:22 +0100 Subject: [PATCH] Tweak setup --- demo/sitetools.cljs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/demo/sitetools.cljs b/demo/sitetools.cljs index d774ab2..f52416f 100644 --- a/demo/sitetools.cljs +++ b/demo/sitetools.cljs @@ -99,12 +99,14 @@ (.isSupported Html5History) (#{"http:" "https:"} proto))))) -(defn create-history [] +(defn create-history [p] (if (use-html5-history) (doto (Html5History.) (.setUseFragment false)) - (doto (History.) - (.setToken @page)))) + (let [h (History.)] + (when p + (.setToken h p)) + h))) (def history nil) @@ -112,9 +114,9 @@ (if (use-html5-history) (:base-path @config))) -(defn setup-history [] +(defn setup-history [p] (when (nil? history) - (set! history (create-history)) + (set! history (create-history p)) (swap! page-state assoc :has-history (some? history)) (when-let [h history] (evt/listen h hevt/NAVIGATE @@ -259,7 +261,7 @@ (swap! config merge conf) (when page-name (set-start-page page-name)) - (setup-history) + (setup-history page-name) (set! (.-title js/document) (get-title)) (reagent/render-component (body) (.' js/document :body)))))