Skip to content

Instantly share code, notes, and snippets.

@fehrenbach
Created July 25, 2011 19:17
Show Gist options
  • Select an option

  • Save fehrenbach/1104927 to your computer and use it in GitHub Desktop.

Select an option

Save fehrenbach/1104927 to your computer and use it in GitHub Desktop.
ClojureScript and Sencha Touch
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Hello World</title>
<script src="lib/touch/sencha-touch.js" type="text/javascript"></script>
<script type="text/javascript" src="out/goog/base.js"></script>
<script src="test.js" type="text/javascript"></script>
<script>goog.require('test');</script>
<link href="lib/touch/resources/css/sencha-touch.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">test.init();</script>
</head>
<body></body>
</html>
(ns test)
(defn make-js-map
"makes a javascript map from a clojure one
(stolen from https://gist.github.com/1098417)"
[cljmap]
(let [out (js-obj)]
(doall (map #(aset out (name (first %)) (second %)) cljmap))
out))
(defn ^:export init []
(Ext.Application. (make-js-map {"launch" #(Ext.Panel. (make-js-map {"fullscreen" true, "html" "Hello World!!"}))})))
@fehrenbach

Copy link
Copy Markdown
Author

Assumes Sencha Touch in lib/touch/ and can be built with $ cljsc . > test.js
Layout: $ ls
index.html lib out test.cljs test.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment