I'm having some trouble with what should be a trivial application of 
core.async and cljs-http. I have tried to debug it, but I don't have a 
great setup for properly debugging. Also, debugging core.async channels is 
well above my current ability.

I've whittled the code down to the least common denominator. The code is 
pasted below as well as available here: https://www.refheap.com/85610.

(ns shouter.core
  (:require-macros [cljs.core.async.macros :refer [go]])
  (:require [om.core :as om :include-macros true]
            [om.dom :as dom :include-macros true]
            [cljs-http.client :as http]
            [cljs.core.async :refer [>! <! chan put!]]))

(enable-console-print!)

(def app-state (atom {:shouts [{:shout "shout 1"}{:shout "shout 2"}]}))

(defn- fetch-shouts [page]
  (let [c (chan)]
    (go (let [response (<! (http/get "http://google.com";))]
            (>! c response)))
    c))

(defn shouts-view [app owner]
  (reify
    om/IWillMount
    (will-mount [_]
                (go (let [shouts (<! (fetch-shouts 1))]
                      (prn shouts))))
    om/IRender
    (render [_]
           (apply dom/ul nil
                  (map #(dom/li nil (:shout %)) (:shouts app))))))

(om/root
 shouts-view
 app-state
 {:target (. js/document (getElementById "container"))})


The error I'm getting is:


   1. Uncaught TypeError: undefined is not a function core.cljs:33
      1. requestcore.cljs:33
      2. cljs_http.client.wrap_edn_paramsclient.cljs:65
      3. 
      
cljs_http.client.wrap_edn_response.cljs.core.async.impl.dispatch.run.call.switch__6217__auto__
      client.cljs:72
      4. (anonymous function)client.cljs:72
      5. 
      
cljs_http.client.wrap_edn_response.cljs.core.async.impl.dispatch.run.call.state_machine__6218__auto____1
      client.cljs:72
      6. 
      
cljs_http.client.wrap_edn_response.cljs.core.async.impl.dispatch.run.call.state_machine__6218__auto__
      client.cljs:72
      7. run_state_machineioc_helpers.cljs:34
      8. run_state_machine_wrappedioc_helpers.cljs:38
      9. (anonymous function)client.cljs:72
      10. process_messagesdispatch.cljs:19
      11. cljs.core.async.impl.dispatch.message_channel.port1.onmessage
      

Any help would be greatly appreciated. I am trying to tie together a light 
restful service backend to a heavy client frontend with Om. It has been 
really fun so far, but running into snags like above is really putting a 
damper on things.

Regards,
Joseph

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to