Skip to content

Commit

Permalink
Rename timeout transition function
Browse files Browse the repository at this point in the history
There is no timeout state so the name makes no sense.
  • Loading branch information
Grazfather committed Sep 26, 2021
1 parent 78e79fb commit 1cc0852
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions lib/new-modal.fnl
Original file line number Diff line number Diff line change
Expand Up @@ -137,20 +137,22 @@ switching menus in one place which is then powered by config.fnl.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(fn show-modal-menu
[{:menu menu}]
[context]
"
Main API to display a modal and run side-effects
- Display the modal alert
Takes current modal state from our modal statemachine
Returns the function to cleanup everything it sets up
"
(lifecycle.enter-menu menu)
(om.modal-alert menu)
(let [unbind-keys (bind-menu-keys menu.items)]
(lifecycle.enter-menu context.menu)
(om.modal-alert context.menu)
(let [unbind-keys (bind-menu-keys context.menu.items)
stop-timeout context.stop-timeout]
(fn []
(hs.alert.closeAll 0)
(unbind-keys)
(lifecycle.exit-menu menu)
(call-when stop-timeout)
(lifecycle.exit-menu context.menu)
)))


Expand Down Expand Up @@ -254,7 +256,7 @@ switching menus in one place which is then powered by config.fnl.
:context (merge state.context {:menu menu})}
:effect :open-submenu}))

(fn active->timeout
(fn add-timeout-transition
[state action extra]
"
Transition from active to idle, but this transition only fires when the
Expand All @@ -266,8 +268,8 @@ switching menus in one place which is then powered by config.fnl.
Takes the current modal state table.
Returns a the old state with a :stop-timeout added
"
(log.wf "TRANSITION: active->timeout") ;; DELETEME
{:state {:current-state :submenu
(log.wf "TRANSITION: add-timeout-transition") ;; DELETEME
{:state {:current-state state.context.current-state
:context
(merge state.context {:stop-timeout (om.timeout om.deactivate-modal)})}
:effect :open-submenu})
Expand Down Expand Up @@ -308,13 +310,13 @@ switching menus in one place which is then powered by config.fnl.
:leave-app noop}
:active {:deactivate active->idle
:activate active->submenu
:start-timeout active->timeout
:start-timeout add-timeout-transition
:enter-app active->enter-app
:leave-app active->leave-app}
:submenu {:deactivate active->idle
:activate active->submenu
:previous submenu->previous
:start-timeout active->timeout
:start-timeout add-timeout-transition
:enter-app noop
:leave-app noop}})

Expand Down

0 comments on commit 1cc0852

Please sign in to comment.