rename action function, plus use 'case' for performance

This commit is contained in:
mike-thompson-day8 2015-11-04 17:11:42 +11:00
parent 4e45d632aa
commit 075af4bee2
1 changed files with 4 additions and 4 deletions

View File

@ -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)]