@jocrau: would it be a problem if other states would have to wait before the response has been received, when starting?
@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)))
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):
=> @@seed-data
"{\"ip\":\"10.23.42.110\",\"about\":\"/about\",\"Pro!\":\"<http://getjsonip.com>\"}"
here http/get
takes a callback, but you can do the same thing with a channel