Fork me on GitHub
#re-frame
<
2018-09-24
>
ingesol10:09:30

The event handler function for your browser event delegates the logical event to a re-frame event handler, roughly like this: (dispatch [:my-event (.. browser-event -target -value)])

ingesol10:09:59

Full context: [:a {:on-click (fn [e] (dispatch [:my-event (.. e -target -value)]))}]

ingesol10:09:33

This way your re-frame event handler can be pure

lvh14:09:10

yep, that's what I'mdoing

ferossgp15:09:43

Hi! I have a reg-sub-raw and inside it I do a subscribe. I want to do something like add-watch to atom of the subscribe, is there a possibility to do that? Cause right now watches is added but on change it does not trigger callback.

(reg-sub-raw
 ::test
 (fn [_ _]
   (let [my-ratom (subscribe [::get-token])]
     (add-watch my-ratom :key (fn [_ _ _ new]
                                (println new))))))
Then
(dispatch [::change-token "a"]) ;; Changes token in db
Thanks!

ferossgp08:09:16

Solved by storing an atom in db and adding changes and watch directly to it đŸ‘½

mac21:09:24

Why would http-fx call the on-failure handler when Chrome reports that the request succeed and I can see the json response in the Network-XHR tab?

Chris O’Donnell23:09:25

@mac perhaps the status code is 400 or higher?