From 075af4bee20fc078390eee59d1221ee0f0bbaa1f Mon Sep 17 00:00:00 2001 From: mike-thompson-day8 Date: Wed, 4 Nov 2015 17:11:42 +1100 Subject: [PATCH] rename action function, plus use 'case' for performance --- src/re_frame/router.cljs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/re_frame/router.cljs b/src/re_frame/router.cljs index fb6828a..8b184a3 100644 --- a/src/re_frame/router.cljs +++ b/src/re_frame/router.cljs @@ -71,7 +71,7 @@ (-run-queue [this]) (-pause-run [this]) (-exception [this ex]) - (-resume-run [this])) + (-begin-resume [this])) ;; Want to understand this? Look at FSM in -fsm-trigger? @@ -127,7 +127,7 @@ (:yield m) goog.async.nextTick)] ;; almost immediately (later #(-fsm-trigger this :begin-resume nil)))) - (-resume-run + (-begin-resume [this] (-process-1st-event this) ;; do the event which paused processing (-fsm-trigger this :finish-resume nil)) ;; do the rest of the queued events @@ -137,7 +137,7 @@ ;; work out new FSM state and action function for the transition (let [[new-state action-fn] - (condp = [fsm-state trigger] + (case [fsm-state trigger] ; Here is the FSM ;[current-state :trigger] [:new-state action-fn] @@ -158,7 +158,7 @@ ;; event processing is paused - probably by :flush-dom metadata [:paused :add-event ] [:paused #(-add-event this arg1)] - [:paused :begin-resume ] [:resuming #(-resume-run this)] + [:paused :begin-resume ] [:resuming #(-begin-resume this)] ;; processing an event which previously caused the queue to be paused [:resuming :add-event ] [:resuming #(-add-event this arg1)]