- change undo to support separate event :purge-redos
- bump to [org.clojure/clojurescript "0.0-3211"]
This commit is contained in:
hipitihop 2015-04-24 16:12:14 +10:00
parent 06f7a29583
commit 2571cb5e0b
3 changed files with 18 additions and 6 deletions

View File

@ -1,3 +1,8 @@
## v0.4.0 (2015-04-24)
Improvements:
- new handler :purge-redos in core.undo
- move to clojurescript v0.0-3211
## v0.3.2 (2015-04-21)

View File

@ -1,9 +1,9 @@
(defproject re-frame "0.3.2"
(defproject re-frame "0.4.0"
:description "A Clojurescript MVC-like Framework For Writing SPAs Using Regent."
:url "https://github.com/Day8/re-frame.git"
:license {:name "MIT"}
:dependencies [[org.clojure/clojure "1.6.0"]
[org.clojure/clojurescript "0.0-3208"]
[org.clojure/clojurescript "0.0-3211"]
[org.clojure/core.async "0.1.346.0-17112a-alpha"]
[reagent "0.5.0"]]

View File

@ -130,13 +130,11 @@
(handlers/register-base ;; not a pure handler
:undo ;; usage: (dispatch [:undo n])
(fn handler
[_ [_ n clear-redos?]]
[_ [_ n]]
;; if n absent, defaults to 1. If clear-redos? absent, defaults to false.
(if-not (undos?)
(warn "re-frame: you did a (dispatch [:undo]), but there is nothing to undo.")
(do
(undo-n (or n 1))
(when clear-redos? (clear-redos!))))))
(undo-n (or n 1)))))
(defn- redo
@ -163,3 +161,12 @@
(warn "re-frame: you did a (dispatch [:redo]), but there is nothing to redo.")
(redo-n (or n 1)))))
(handlers/register-base ;; not a pure handler
:purge-redos ;; usage: (dispatch [:purge-redo])
(fn handler
[_ _]
(if-not (redos?)
(warn "re-frame: you did a (dispatch [:purge-redos]), but there is nothing to redo.")
(clear-redos!))))