Fork me on GitHub
#re-frame
<
2017-01-15
>
dviramontes05:01:46

Hello, so i have this use case where i need to coordinate two http calls. I’m thinking re-frame/reg-event-fx would be a good solution but i would love to see an example of one so i can wrap my mind around it. From the looks of: https://github.com/Day8/re-frame/wiki/Effectful-Event-Handlers This is what I need:

(reg-event
   :my-event
   (fn [db [_ a]]
       {:http {:method :get
               :url    ""
               :on-success  [:process-blah-response]
               :on-fail     [:failed-blah]}
        :db   (assoc db :flag true)}))

dviramontes05:01:48

i guess my question is how do i turn ☝️:skin-tone-5: into a reg-event-fx

curlyfry11:01:08

@dviramontes Your link is from the old documentation (it says so on the top of the page). I'd suggest looking at the corresponding one in the new docs: https://github.com/Day8/re-frame/blob/master/docs/EffectfulHandlers.md :)

curlyfry11:01:16

I personally prefer to make my own effect handler for my api calls with reg-fx, but that's just that, a preference :) https://github.com/Dexterminator/imperimetric/blob/master/src/cljs/imperimetric/handlers.cljs#L130

ska13:01:04

@edwthomas Interested in updating that gist so that the charts can be dynamically updated with new data?

brthrjon15:01:58

anyone know how to make a re-com slider vertical?

paulspencerwilliams18:01:17

Hi all. Sorry for reposting in here and #cljsrn but it's really an overlapping question.

paulspencerwilliams19:01:24

I'm playing with re-frame using re-natal / React Native and have hit a concern that I've not hit when using re-frame in a typical web app... The need to persist app-db between application restarts. Obviously a mobile app will need to retain state after closing down. Are there any typical patterns for keeping app-db in sync with for example localstorage?

mikethompson22:01:34

@paulspencerwilliams the todomvc example has to keep the todos in localstore. I'd start there. Just to be clear, I mean: see /examples/todomvc/src/todomvc/events.cljs in the repo. Look for the ->local-store interceptor and its use.

mikethompson22:01:58

@brthrjon from the looks of it :v-scroll :on would do the tirick. Have you looked at the docs at http://re-demo.s3-website-ap-southeast-2.amazonaws.com/#/scroller

brthrjon22:01:39

hey, mike, thanks for that. It doesn't look like that is supported by slider. I managed to get it done with this garden code:

brthrjon22:01:42

[(s/input (s/attr= :type :range)) {:writing-mode "bt-lr" :-webkit-appearance "slider-vertical" :height "175px" :padding "20px 5px" }]