Skip to content

Instantly share code, notes, and snippets.

@si14

si14/project.clj Secret

Created February 24, 2012 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save si14/fe7bd94031a026b5fb9c to your computer and use it in GitHub Desktop.
Save si14/fe7bd94031a026b5fb9c to your computer and use it in GitHub Desktop.
(defproject snaptree-webview "1.0.0"
:description "Webview for snapshot tree"
:dependencies [[org.clojure/clojure "1.3.0"]
[jayq "0.1.0-SNAPSHOT"]
[crate "0.1.0-SNAPSHOT"]]
:cljsbuild {:source-path "src"
:compiler
{:output-dir "js/"
:output-to "js/snaptree.js"
:pretty-print true}}
:plugins [[lein-cljsbuild "0.0.14"]])
(ns snaptree
(:require [crate.core :as crate])
(:use [jayq.core :only [$ append delegate data]])
(:use-macros [crate.macros :only [defpartial]]))
(def $tree ($ :#tree))
(defpartial button [{:keys [label action param]}]
[:a.button {:href "#" :data-action action :data-param param} label])
(def $body ($ :body))
(delegate $body button :click
(fn [e]
(.preventDefault e)
(js/alert "clicked!")))
(defn ^:export init []
(append $tree (button {:label "play note"
:action "play-note"
:param ""})))
<html>
<head>
<title>Foobar</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="js/snaptree.js">
</head>
<body>
<div id="tree"></div>
<script>snaptree.init()</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment