rename action function, plus use 'case' for performance
This commit is contained in:
parent
4e45d632aa
commit
075af4bee2
|
@ -71,7 +71,7 @@
|
||||||
(-run-queue [this])
|
(-run-queue [this])
|
||||||
(-pause-run [this])
|
(-pause-run [this])
|
||||||
(-exception [this ex])
|
(-exception [this ex])
|
||||||
(-resume-run [this]))
|
(-begin-resume [this]))
|
||||||
|
|
||||||
|
|
||||||
;; Want to understand this? Look at FSM in -fsm-trigger?
|
;; Want to understand this? Look at FSM in -fsm-trigger?
|
||||||
|
@ -127,7 +127,7 @@
|
||||||
(:yield m) goog.async.nextTick)] ;; almost immediately
|
(:yield m) goog.async.nextTick)] ;; almost immediately
|
||||||
(later #(-fsm-trigger this :begin-resume nil))))
|
(later #(-fsm-trigger this :begin-resume nil))))
|
||||||
|
|
||||||
(-resume-run
|
(-begin-resume
|
||||||
[this]
|
[this]
|
||||||
(-process-1st-event this) ;; do the event which paused processing
|
(-process-1st-event this) ;; do the event which paused processing
|
||||||
(-fsm-trigger this :finish-resume nil)) ;; do the rest of the queued events
|
(-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
|
;; work out new FSM state and action function for the transition
|
||||||
(let [[new-state action-fn]
|
(let [[new-state action-fn]
|
||||||
(condp = [fsm-state trigger]
|
(case [fsm-state trigger]
|
||||||
|
|
||||||
; Here is the FSM
|
; Here is the FSM
|
||||||
;[current-state :trigger] [:new-state action-fn]
|
;[current-state :trigger] [:new-state action-fn]
|
||||||
|
@ -158,7 +158,7 @@
|
||||||
|
|
||||||
;; event processing is paused - probably by :flush-dom metadata
|
;; event processing is paused - probably by :flush-dom metadata
|
||||||
[:paused :add-event ] [:paused #(-add-event this arg1)]
|
[: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
|
;; processing an event which previously caused the queue to be paused
|
||||||
[:resuming :add-event ] [:resuming #(-add-event this arg1)]
|
[:resuming :add-event ] [:resuming #(-add-event this arg1)]
|
||||||
|
|
Loading…
Reference in New Issue