v0.3.1
This commit is contained in:
parent
f9ae1c2923
commit
a12267308e
23
CHANGES.md
23
CHANGES.md
|
@ -1,24 +1,12 @@
|
|||
|
||||
## Planned for v0.4.0
|
||||
|
||||
- automatically wrap subscriptions in a `reaction` (removing the need for over
|
||||
10 keystrokes per handler!!). Just kidding there are better reasons than that.
|
||||
- further develop the debugging story.
|
||||
- modifiy todoMVC for new subscriptions approach
|
||||
- document new sbscriptions approach
|
||||
- move contents of README across to Wiki. Make Readme simpler and more pragmatic.
|
||||
- produce a more fully featured todomvc (beyond the standard one), todomvc-with-extras
|
||||
- use `enrich` to handle todo duplication
|
||||
- add prismatic schema
|
||||
- show testing
|
||||
- show debug
|
||||
- undo
|
||||
|
||||
|
||||
## v0.3.1 (2015-04-18)
|
||||
|
||||
### Other
|
||||
Various small improvements and bug fixes:
|
||||
|
||||
- middleware anonymous functions given better names. Makes stack traces easier to understand.
|
||||
- modest improves to simple example. Better comments, layout, etc.
|
||||
- the anonymous functions in standard middleware now have meaningful
|
||||
names, which makes stack traces easier to understand.
|
||||
- #24 - Fix missing paren in README
|
||||
- #31 - Fix list formatting in README
|
||||
- #32 - fix a broken wiki link
|
||||
|
@ -29,7 +17,6 @@
|
|||
|
||||
### Headline
|
||||
|
||||
|
||||
- the middleware `after` and `enrich` now call the supplied function `f` with
|
||||
both `db` and `v` (previously just `db`). Because javascript is so forgiving
|
||||
about function arity, this change is backwards compatible.
|
||||
|
|
|
@ -22,29 +22,41 @@
|
|||
|
||||
;; -- Subscription handlers and registration ---------------------------------
|
||||
|
||||
(register-sub
|
||||
(def register-sub-2 (fn [a b c])) ;; XXXremove
|
||||
(def fetch (fn [a])) ;; XXXremove
|
||||
|
||||
(register-sub-2
|
||||
:todos ;; usage: (subscribe [:todos])
|
||||
(fn [db _]
|
||||
(reaction (vals (:todos @db)))))
|
||||
(fetch :todos)
|
||||
(fn [todos _]
|
||||
(vals todos)))
|
||||
|
||||
(register-sub
|
||||
(register-sub-2
|
||||
:visible-todos
|
||||
(fn [db _]
|
||||
(reaction (let [filter-fn (filter-fn-for (:showing @db))
|
||||
todos (vals (:todos @db))]
|
||||
(filter filter-fn todos)))))
|
||||
[(fetch :todos) (fetch :showing)]
|
||||
(fn [todos showing _]
|
||||
(filter (filter-fn-for showing) (vals todos))))
|
||||
|
||||
(register-sub
|
||||
(register-sub-2
|
||||
:completed-count
|
||||
(fn [db _]
|
||||
(reaction (completed-count (:todos @db)))))
|
||||
(fetch :todos)
|
||||
(fn [todos _]
|
||||
(completed-count todos)))
|
||||
|
||||
(register-sub
|
||||
(register-sub-2
|
||||
:footer-stats
|
||||
(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
|
||||
[(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
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue