Move examples to v0.3.1.

Plus undo previous mistaken checkin to todomvc
This commit is contained in:
mike-thompson-day8 2015-04-17 22:42:46 +10:00
parent a12267308e
commit f69b7cd332
4 changed files with 32 additions and 44 deletions

View File

@ -3,8 +3,8 @@
:dependencies [[org.clojure/clojure "1.6.0"]
[org.clojure/clojurescript "0.0-2816"]
[reagent "0.5.0"]
[re-frame "0.3.0"]
[figwheel "0.2.3-SNAPSHOT"]]
[re-frame "0.3.1"]
[figwheel "0.2.6"]]
:plugins [[lein-cljsbuild "1.0.4"]
[lein-figwheel "0.2.3-SNAPSHOT"]]

View File

@ -1,8 +1,8 @@
(defproject todomvc-re-frame "0.3.0"
(defproject todomvc-re-frame "0.3.1"
:dependencies [[org.clojure/clojure "1.6.0"]
[org.clojure/clojurescript "0.0-2816"]
[reagent "0.5.0"]
[re-frame "0.3.0"]
[re-frame "0.3.1"]
[secretary "1.2.1"]]
:plugins [[lein-cljsbuild "1.0.4"]]

View File

@ -22,41 +22,29 @@
;; -- Subscription handlers and registration ---------------------------------
(def register-sub-2 (fn [a b c])) ;; XXXremove
(def fetch (fn [a])) ;; XXXremove
(register-sub-2
(register-sub
:todos ;; usage: (subscribe [:todos])
(fetch :todos)
(fn [todos _]
(vals todos)))
(fn [db _]
(reaction (vals (:todos @db)))))
(register-sub-2
(register-sub
:visible-todos
[(fetch :todos) (fetch :showing)]
(fn [todos showing _]
(filter (filter-fn-for showing) (vals todos))))
(fn [db _]
(reaction (let [filter-fn (filter-fn-for (:showing @db))
todos (vals (:todos @db))]
(filter filter-fn todos)))))
(register-sub-2
(register-sub
:completed-count
(fetch :todos)
(fn [todos _]
(completed-count todos)))
(fn [db _]
(reaction (completed-count (:todos @db)))))
(register-sub-2
(register-sub
:footer-stats
[(fetch :todos) (fetch :showing)]
(fn [todos showing _]
(let [completed-count (completed-count todos)
active-count (- (count todos) completed-count)]
[active-count completed-count showing]))) ;; tuple
;; So [:todos :showing] is the same as [(pull [:todos]) (from [:showing])]
;; a keyword or vector is wrapped in "from"
;; a fucntion is called with 'app-db' and 'v'
;; What about the base case: no accessors
(fn [db _]
(reaction
(let [todos (:todos @db)
completed-count (completed-count todos)
active-count (- (count todos) completed-count)
showing (:showing @db)]
[active-count completed-count showing])))) ;; tuple

View File

@ -1,4 +1,4 @@
(defproject re-frame "0.4.0.SNAPSHOT"
(defproject re-frame "0.3.1"
:description "A Clojurescript MVC-like Framework For Writing SPAs Using Regent."
:url "https://github.com/Day8/re-frame.git"
:license {:name "MIT"}