hoplon

The :hoplon: ClojureScript Web Framework - http://hoplon.io/
2018-01-08T04:04:30.000106Z

@flyboarder is this like a "lifecycle" thing for components, or a way to categorise data associated with the component?

flyboarder 2018-01-08T04:56:31.000054Z

@thedavidmeister a state machine for elements i guess

2018-01-08T04:57:27.000128Z

ok so you're moving through each of these states in response to something

flyboarder 2018-01-08T04:59:36.000076Z

Yes

2018-01-08T05:04:11.000032Z

looks to me like the lifecycle of async data (e.g. from user input or remote server) rather than a DOM component

2018-01-08T05:06:31.000038Z

e.g. i'm working on a simple "read more" popdown icon atm and it looks like this:

2018-01-08T05:06:40.000134Z

(h/defelem vertical
 [{:keys [expand? current-el? enabled?]}]
 (let [expand? (or expand? (j/cell false))
       current-el? (or current-el? (j/cell false))
       enabled? (or enabled? (j/cell true))]
  ; el gaining current status should also expand but losing current should not
  ; hide automatically
  (h/do-watch current-el?
   (fn [_ n]
    (when (and n @enabled?)
     (reset! expand? true))))

  (h/div
   :garden {:cursor :pointer}

   (h/if-tpl enabled?
    (h/div
     ; current-el? uses click so we do here as well to avoid async issues
     :click (fn [e]
             (swap! expand? not)
             (wheel.dom.events/stop-propagation e))
     (icons.hoplon/icon "#more"))

    (h/div :class "icon-space")))))

2018-01-08T05:07:39.000103Z

the states are focussed on managing whether the current element is in focus, whether the icon should display, whether the content is currently expanded, etc.