Fork me on GitHub
#cljsrn
<
2017-04-19
>
benny06:04:15

I’m still trying to wrap my head around core.async so this one might seem obvious, but I’m trying to extract a value out of AsyncStorage as a coeffect but the only means I have to extract it is via the js API with callbacks or something like “core-async-storage” (https://github.com/glittershark/core-async-storage)

benny06:04:46

When I use the core-async-storage, I’m not sure how I can add my key to the coeffect?

benny06:04:02

trying something like this just associates the channel:

(reg-cofx
  :load-token
  (fn [cofx _]
    (assoc cofx :token (go (<! (get-item :token))))))

mccraigmccraig12:04:56

@benny afaiu the current co-effects impl only really works for synchronous co-effects

mccraigmccraig12:04:55

i use async storage (via cordova) and tend to fire re-frame events when promises are realised to stuff data into app-db

mccraigmccraig12:04:32

an async-compatible co-effect impl would be sweet though!