This commit is contained in:
Mike Thompson 2017-10-30 22:19:52 +11:00
parent a509b21abf
commit 682aed49cd
3 changed files with 11 additions and 3 deletions

View File

@ -1,7 +1,8 @@
## Unreleased
#### New Features
#### New
- add `purge-event-queue` to the API. See https://github.com/Day8/re-frame-test/issues/13 for motivation.
- added [a new FAQ entry](/docs/FAQs/DoINeedReFrame.md) Reagent looks terrific. Why do I need re-frame?
## 0.10.2 (2017.10.07)

View File

@ -191,6 +191,10 @@
(reset! db/app-db app-db)
nil)))
(defn purge-event-queue
"Remove all events queued for processing"
[]
(router/purge re-frame.router/event-queue))
;; -- Event Processing Callbacks ---------------------------------------------

View File

@ -74,6 +74,7 @@
(push [this event])
(add-post-event-callback [this id callack])
(remove-post-event-callback [this f])
(purge [this])
;; -- Implementation via a Finite State Machine
(-fsm-trigger [this trigger arg])
@ -113,6 +114,8 @@
(->> (dissoc post-event-callback-fns id)
(set! post-event-callback-fns))))
(purge [_]
(set! queue empty-queue))
;; -- FSM Implementation ---------------------------------------------------
@ -195,8 +198,8 @@
(recur (dec n)))))))
(-exception
[_ ex]
(set! queue empty-queue) ;; purge the queue
[this ex]
(purge this) ;; purge the queue
(throw ex))
(-pause