-
-
Save si14/fe7bd94031a026b5fb9c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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"]]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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 ""}))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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