Update demo to use rswap!

and fix old-style url in new051
This commit is contained in:
Dan Holmsand 2015-09-24 11:05:37 +02:00
parent be1dfaeba7
commit f62bf44661
2 changed files with 2 additions and 21 deletions

View File

@ -6,7 +6,7 @@
[sitetools.core :as tools :refer [link]]
[reagentdemo.common :as common :refer [demo-component]]))
(def url "news/news051.html")
(def url "/news/news051.html")
(def title "News in 0.5.1")
(def ns-src (s/syntaxed "(ns example.core

View File

@ -9,25 +9,6 @@
(enable-console-print!)
(defn rswap! [a f & args]
;; Like swap!, except that recursive swaps on the same atom are ok,
;; and always returns nil.
{:pre [(satisfies? ISwap a)
(ifn? f)]}
(if a.rswapping
(-> (or a.rswapfs (set! a.rswapfs (array)))
(.push #(apply f % args)))
(do (set! a.rswapping true)
(try (swap! a (fn [state]
(loop [s (apply f state args)]
(if-some [sf (some-> a.rswapfs .shift)]
(recur (sf s))
s))))
(finally
(set! a.rswapping false)))))
nil)
;;; Configuration
(declare main-content)
@ -69,7 +50,7 @@
(defn dispatch [event]
;; (dbg event)
(rswap! config demo-handler event))
(r/rswap! config demo-handler event))
(defn register-page [url comp title]
{:pre [(re-matches #"/.*[.]html" url)