first commit

master
Abhinav Sarkar 2013-09-15 03:19:05 +05:30
commit 6c5ed886bd
5 changed files with 58 additions and 0 deletions

9
.gitignore vendored Normal file
View File

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

19
project.clj Normal file
View File

@ -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}}]})

6
src/clj/frpong/core.clj Normal file
View File

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

View File

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

20
src/cljs/frpong/core.cljs Normal file
View File

@ -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))))))))