first commit

master
Abhinav Sarkar 10 years ago
commit 6c5ed886bd
  1. 9
      .gitignore
  2. 19
      project.clj
  3. 6
      src/clj/frpong/core.clj
  4. 4
      src/cljs/frpong/connect.cljs
  5. 20
      src/cljs/frpong/core.cljs

9
.gitignore vendored

@ -0,0 +1,9 @@
/target
/classes
/checkouts
pom.xml
pom.xml.asc
*.jar
*.class
/.lein-*
/.nrepl-port

@ -0,0 +1,19 @@
(defproject frpong "0.1.0-SNAPSHOT"
:description "FRP Pong in ClojureScript using core.async"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:source-paths ["src/clj"]
:dependencies [[org.clojure/clojure "1.5.1"]
[domina "1.0.2-SNAPSHOT"]
[org.clojure/clojurescript "0.0-1878"]
[org.clojure/core.async "0.1.222.0-83d0c2-alpha"]]
:plugins [[lein-cljsbuild "0.3.3"]]
:cljsbuild {:builds
[{:source-paths ["src/cljs"]
:compiler {:output-to "resources/public/js/frpong.js"
:optimizations :whitespace
:pretty-print true}}]})

@ -0,0 +1,6 @@
(ns frpong.core)
(defn foo
"I don't do a whole lot."
[x]
(println x "Hello, World!"))

@ -0,0 +1,4 @@
(ns modern-cljs.connect
(:require [clojure.browser.repl :as repl]))
(repl/connect "http://localhost:9000/repl")

@ -0,0 +1,20 @@
(ns frpong.core
(:require [cljs.core.async :as async
:refer [<! >! chan put!]]
[domina :as dom]
[domina.events :as ev])
(:require-macros [cljs.core.async.macros :as m :refer [go]]))
(defn event-chan [event-type]
(let [c (chan)]
(ev/listen! js/document event-type
(fn [e] (put! c e)))
c))
(defn ^:export init []
(let [mm-chan (event-chan :mousemove)]
(go
(while true
(let [e (<! mm-chan)]
(.log js/console (str (:clientX e) " , " (:clientY e))))))))
Loading…
Cancel
Save