Merge branch 'master' into develop
Conflicts: README.md examples/todomvc/src/todomvc/db.cljs
This commit is contained in:
commit
915ad9a351
|
@ -12,4 +12,4 @@ before_script:
|
|||
- "echo 'Installing Slimer'"
|
||||
- "wget http://download.slimerjs.org/releases/0.9.4/slimerjs-0.9.4.zip"
|
||||
- "unzip slimerjs-0.9.4.zip"
|
||||
- "mv slimerjs-0.9.4 ./slimerjs"
|
||||
- "mv slimerjs-0.9.4 ./slimerjs"
|
||||
|
|
30
CHANGES.md
30
CHANGES.md
|
@ -10,44 +10,44 @@ Improvements
|
|||
Improvements:
|
||||
- fix #65 - Detect mistaken use of middleware factories
|
||||
- `examples/` now work with figwheel
|
||||
|
||||
|
||||
|
||||
## v0.4.0 (2015-05-04)
|
||||
|
||||
Headline:
|
||||
- Exceptions in event handlers no longer break the router loop.
|
||||
- Exceptions in event handlers no longer break the router loop.
|
||||
Previously, any exception in an event handler broke the app
|
||||
permanently. This change will:
|
||||
- improve the debugging experience with figwheel
|
||||
- improve the debugging experience with figwheel
|
||||
- mean apps, in production, stand a chance of reporting UHE
|
||||
to the user, and can perhaps even recover to a sane state.
|
||||
- #53 Fix Logging And Error Reporting
|
||||
You can now provide your own logging fucntions.
|
||||
You can now provide your own logging fucntions.
|
||||
Further explanation [here](https://github.com/Day8/re-frame/wiki/FAQ#3-can-re-frame-use-my-logging-functions).
|
||||
|
||||
|
||||
Deprecated:
|
||||
- `log-ex` middleware is no longer needed. Simply remove its use.
|
||||
- `log-ex` middleware is no longer needed. Simply remove its use.
|
||||
Sometime in the last couple of months, changes to the CLJS
|
||||
runtime meant that useful exceptions could escape go-loops, and
|
||||
good stack traces appear (at least in Chrome).
|
||||
|
||||
good stack traces appear (at least in Chrome).
|
||||
|
||||
New Features:
|
||||
- #52 Add a way to purge redos `(dispatch [:purge-redos])`
|
||||
When trying to recover from an UHE, do an undo to get back to the
|
||||
last sane state, and then use this new feature to purge the
|
||||
just-generated-redo.
|
||||
- #43 Add ability to clear handlers (event and subs) via
|
||||
When trying to recover from an UHE, do an undo to get back to the
|
||||
last sane state, and then use this new feature to purge the
|
||||
just-generated-redo.
|
||||
- #43 Add ability to clear handlers (event and subs) via
|
||||
two new API functions:
|
||||
- re-frame.core/clear-sub-handlers!
|
||||
- re-frame.core/clear-event-handlers!
|
||||
Useful for those using the [ClojureScript fork](https://github.com/quile/component-cljs) of [Component](https://github.com/stuartsierra/component).
|
||||
|
||||
|
||||
Experimental:
|
||||
- #50 Add "reaction-like" middleware called `on-changes`.
|
||||
|
||||
|
||||
Other:
|
||||
- improve some comments in todomvc example
|
||||
|
||||
|
||||
|
||||
## v0.3.2 (2015-04-21)
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
(ns simpleexample.core
|
||||
(:require-macros [reagent.ratom :refer [reaction]])
|
||||
(:require-macros [reagent.ratom :refer [reaction]])
|
||||
(:require [reagent.core :as reagent]
|
||||
[re-frame.core :refer [register-handler
|
||||
path
|
||||
|
@ -22,7 +22,7 @@
|
|||
|
||||
(register-handler ;; setup initial state
|
||||
:initialize ;; usage: (submit [:initialize])
|
||||
(fn
|
||||
(fn
|
||||
[db _]
|
||||
(merge db initial-state))) ;; what it returns becomes the new state
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
|||
(register-handler
|
||||
:timer
|
||||
(fn
|
||||
;; the first item in the second argument is :timer the second is the
|
||||
;; the first item in the second argument is :timer the second is the
|
||||
;; new value
|
||||
[db [_ value]]
|
||||
(assoc db :timer value))) ;; return the new version of db
|
||||
|
@ -49,14 +49,14 @@
|
|||
|
||||
(register-sub
|
||||
:timer
|
||||
(fn
|
||||
(fn
|
||||
[db _] ;; db is the app-db atom
|
||||
(reaction (:timer @db)))) ;; wrap the computation in a reaction
|
||||
|
||||
|
||||
(register-sub
|
||||
:time-color
|
||||
(fn
|
||||
(fn
|
||||
[db _]
|
||||
(reaction (:time-color @db))))
|
||||
|
||||
|
|
|
@ -391,4 +391,4 @@ html #clear-completed:active {
|
|||
#filters {
|
||||
bottom: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
14
project.clj
14
project.clj
|
@ -6,22 +6,22 @@
|
|||
[org.clojure/clojurescript "0.0-3211"]
|
||||
[org.clojure/core.async "0.1.346.0-17112a-alpha"]
|
||||
[reagent "0.5.0"]]
|
||||
|
||||
|
||||
:profiles {:debug {:debug true}
|
||||
:dev {:dependencies [[spellhouse/clairvoyant "0.0-48-gf5e59d3"]]
|
||||
:plugins [[lein-cljsbuild "1.0.5"]
|
||||
[com.cemerick/clojurescript.test "0.3.3"]]}}
|
||||
|
||||
|
||||
|
||||
|
||||
:clean-targets [:target-path
|
||||
"run/compiled/demo"]
|
||||
|
||||
|
||||
:resource-paths ["run/resources"]
|
||||
:jvm-opts ["-Xmx1g" "-XX:+UseConcMarkSweepGC"] ;;
|
||||
:source-paths ["src"]
|
||||
:test-paths ["test"]
|
||||
|
||||
|
||||
|
||||
:cljsbuild {:builds [{:id "test" ;; currently bogus, there is no demo or tests
|
||||
:source-paths ["test"]
|
||||
:compiler {:output-to "run/compiled/test.js"
|
||||
|
@ -29,14 +29,14 @@
|
|||
:output-dir "run/compiled/test"
|
||||
:optimizations :simple
|
||||
:pretty-print true}}]
|
||||
|
||||
|
||||
:test-commands {"rhino" ["rhino" "-opt" "-1" :rhino-runner
|
||||
"run/compiled/test.js"]
|
||||
"slimer" ["xvfb-run" "-a" "slimerjs" :runner
|
||||
"run/compiled/test.js"]
|
||||
"phantom" ["phantomjs" ; doesn't work with phantomjs < 2.0.0
|
||||
:runner "run/compiled/test.js"]}}
|
||||
|
||||
|
||||
:aliases {"auto" ["do" "clean," "cljsbuild" "clean," "cljsbuild" "auto" "demo,"]
|
||||
"once" ["do" "clean," "cljsbuild" "clean," "cljsbuild" "once" "demo,"]
|
||||
"test-rhino" ["do" "clean," "cljsbuild" "once," "cljsbuild" "test" "rhino"]
|
||||
|
|
|
@ -90,7 +90,7 @@
|
|||
|
||||
;; -- Middleware Factories ----------------------------------------------------
|
||||
;;
|
||||
;; Note: wierd approach defn-ing middleware factories below. Why? Because
|
||||
;; Note: weird approach defn-ing middleware factories below. Why? Because
|
||||
;; I wanted to put some metadata on them (useful for later checking).
|
||||
;; Found I had to do it this way:
|
||||
;; (def fn-name
|
||||
|
@ -98,7 +98,7 @@
|
|||
;; ^{....} ;; middleware put on the following fn
|
||||
;; (fn fn-name ....))
|
||||
;;
|
||||
;; So, yeah, wierd.
|
||||
;; So, yeah, weird.
|
||||
|
||||
(def path
|
||||
"A middleware factory which supplies a sub-tree of `db` to the handler.
|
||||
|
@ -113,9 +113,9 @@
|
|||
^{:re-frame-factory-name "path"}
|
||||
(fn path
|
||||
[& args]
|
||||
(let [path (flatten args)
|
||||
_ (if (empty? path)
|
||||
(error "re-frame: \"path\" middleware given no params."))]
|
||||
(let [path (flatten args)]
|
||||
(when (empty? path)
|
||||
(error "re-frame: \"path\" middleware given no params."))
|
||||
(fn path-middleware
|
||||
[handler]
|
||||
(fn path-handler
|
||||
|
|
|
@ -15,19 +15,19 @@
|
|||
|
||||
(deftest trim-v
|
||||
(let [handler (fn [db vect] vect)]
|
||||
(is (= (handler nil [:a :b :c])
|
||||
(is (= (handler nil [:a :b :c])
|
||||
[:a :b :c]))
|
||||
(is (= ((middleware/trim-v handler) nil [:a :b :c])
|
||||
(is (= ((middleware/trim-v handler) nil [:a :b :c])
|
||||
[:b :c]))))
|
||||
|
||||
(deftest path
|
||||
(let [db {:a true}
|
||||
handler (fn
|
||||
[a [_]]
|
||||
(not a))]
|
||||
handler (fn
|
||||
[a [_]]
|
||||
(not a))]
|
||||
(let [new-db (((middleware/path [:a])
|
||||
handler) db [nil])]
|
||||
(is (= (:a new-db)
|
||||
(is (= (:a new-db)
|
||||
false)))))
|
||||
|
||||
|
||||
|
@ -38,4 +38,4 @@
|
|||
(is (= (wrapped {:a 0 :b 2} 0) ;; no change in 'a'
|
||||
{:a 0 :b 2}))
|
||||
(is (= (wrapped {:a 4 :b 2} 0) ;; 'a' changed to 0
|
||||
{:c 2 :a 0 :b 2})))) ;; 'c' is a + b
|
||||
{:c 2 :a 0 :b 2})))) ;; 'c' is a + b
|
||||
|
|
Loading…
Reference in New Issue