Skip to content

Instantly share code, notes, and snippets.

@pjagielski
Last active October 2, 2015 10:07
Show Gist options
  • Save pjagielski/538ecac3dd04c7ca939d to your computer and use it in GitHub Desktop.
Save pjagielski/538ecac3dd04c7ca939d to your computer and use it in GitHub Desktop.
[org.clojure/clojurescript "1.7.48"]
[org.clojure/core.async "0.1.346.0-17112a-alpha"]
[cljs-http "0.1.37"]
(:require-macros [cljs.core.async.macros :refer [go]])
(:require [cljs-http.client :as http]
[cljs.core.async :refer [<! >! chan]]))
(defn rest-call []
(go
(let [response (<! (http/get "/hello"))]
(println response))))
[org.omcljs/om "0.9.0"]
[prismatic/om-tools "0.3.12"]
(:require
[om.core :as om]
[om-tools.core :refer-macros [defcomponent]]
[om-tools.dom :as dom :include-macros true])
(def app-state (atom {:message "hello from om"}))
(defcomponent app [data owner]
(render [_]
(dom/div (:message data))))
(om/root app app-state
{:target (.getElementById js/document "main")})
(will-mount [_]
(go
(let [response (<! (http/get "/hello"))]
(when (:success response)
(om/update! data :message (get-in response [:body :hello]))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment