Skip to content

Instantly share code, notes, and snippets.

@cstorey
Created September 8, 2012 20:53
Show Gist options
  • Save cstorey/3679640 to your computer and use it in GitHub Desktop.
Save cstorey/3679640 to your computer and use it in GitHub Desktop.
Using Flapjax in ClojureScript
<html>
<head>
<title>Flapjax Demo: Time 1</title>
</head>
<p>The time is <span class="fixedBlock"><span id="timer">not initialized</span></span>.</p>
<p>The time in seconds is <span class="fixedBlock"><span id="timer2">not initialized</span></span>.</p>
<script type="text/javascript" src="main.js"></script>
</body>
</html>
(defproject fjaxexamples "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.4.0"]]
:plugins [[lein-cljsbuild "0.2.7"]]
:cljsbuild {
:builds {:main {:source-path "src-cljs"
:compiler {:output-to "resources/public/main.js"
:optimizations :whitespace
:pretty-print true
;; This file comes from https://github.com/brownplt/flapjax/blob/master/src/flapjax.js
:libs ["resources/public/flapjax.js"] }}}}
)
(ns time
(:require [F]))
(def timeB (F/timerB 100))
(F/insertDomB timeB "timer")
(def secondB (F/liftB #(Math/floor (/ % 1000)) timeB))
(F/insertDomB secondB "timer2")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment