first commit
This commit is contained in:
commit
6c5ed886bd
9
.gitignore
vendored
Normal file
9
.gitignore
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
/target
|
||||
/classes
|
||||
/checkouts
|
||||
pom.xml
|
||||
pom.xml.asc
|
||||
*.jar
|
||||
*.class
|
||||
/.lein-*
|
||||
/.nrepl-port
|
19
project.clj
Normal file
19
project.clj
Normal 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
6
src/clj/frpong/core.clj
Normal file
@ -0,0 +1,6 @@
|
||||
(ns frpong.core)
|
||||
|
||||
(defn foo
|
||||
"I don't do a whole lot."
|
||||
[x]
|
||||
(println x "Hello, World!"))
|
4
src/cljs/frpong/connect.cljs
Normal file
4
src/cljs/frpong/connect.cljs
Normal 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
20
src/cljs/frpong/core.cljs
Normal 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))))))))
|
Loading…
Reference in New Issue
Block a user