mount

arnout 2016-07-18T10:52:50.000028Z

@jocrau: would it be a problem if other states would have to wait before the response has been received, when starting?

tolitius 2016-07-18T14:09:08.000032Z

@jocrau: was out for a couple of days.. would something like this work for you:

(defstate seed-data :start (let [data (atom :empty)]
                             (http/get "<http://jsonip.com/>" {} (fn [{:keys [body]}]
                                                                 (reset! data body))
                             data)))

tolitius 2016-07-18T14:10:46.000033Z

in case you are in cljc mode (for clojurescript), you would have to deref it twice to get the value (since data is an atom):

=&gt; @@seed-data
"{\"ip\":\"10.23.42.110\",\"about\":\"/about\",\"Pro!\":\"<http://getjsonip.com>\"}"

tolitius 2016-07-18T14:11:20.000034Z

here http/get takes a callback, but you can do the same thing with a channel