mirror of
https://github.com/status-im/reagent.git
synced 2025-01-13 13:24:47 +00:00
Update demo to use rswap!
and fix old-style url in new051
This commit is contained in:
parent
be1dfaeba7
commit
f62bf44661
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user