|
7 | 7 | ;; You must not remove this notice, or any other, from this software.
|
8 | 8 |
|
9 | 9 | (ns repl.test
|
10 |
| - (:require [clojure.browser.repl :as repl] |
11 |
| - [clojure.browser.dom :as dom])) |
| 10 | + (:require [clojure.browser.repl :as repl])) |
12 | 11 |
|
13 | 12 | (repl/connect "http://localhost:9000/repl")
|
14 | 13 |
|
|
35 | 34 |
|
36 | 35 | ;; Evaluate some basic forms
|
37 | 36 | (+ 1 1)
|
38 |
| - ;; TODO: Chrome has a problem with keywords |
39 | 37 | {:a :b}
|
40 | 38 | "hello"
|
41 | 39 | (reduce + [1 2 3 4 5])
|
42 | 40 | (js/alert "Hello World!")
|
43 | 41 |
|
44 |
| - ;; Can only load files that depend on what is already avaialble. |
45 | 42 | (load-file "clojure/string.cljs")
|
46 | 43 | (clojure.string/reverse "Hello")
|
47 | 44 |
|
48 |
| - ;; TODO: This is not being done automatically as it is in rhino. |
49 |
| - (ns cljs.user) |
50 | 45 | (defn sum [coll] (reduce + coll))
|
51 | 46 | (sum [2 2 2 2])
|
52 | 47 |
|
53 | 48 | ;; Create dom elements.
|
54 |
| - ;; This require only works because we have already compiled |
55 |
| - ;; 'clojure.browser.dom when the project was built. |
56 | 49 | (ns dom.testing (:require [clojure.browser.dom :as dom]))
|
57 | 50 | (dom/append (dom/get-element "content")
|
58 | 51 | (dom/element "Hello World!"))
|
59 | 52 |
|
60 |
| - ;; TODO: This will not work unless you have already required what it |
61 |
| - ;; depends on. You may think that just copying all of goog to 'out' |
62 |
| - ;; will solve the problem but it may not in every case. What if this |
63 |
| - ;; depends on another cljs file which has not been compiled? |
64 |
| - (load-file "clojure/browser/dom.cljs") |
| 53 | + ;; Load something we haven't used yet |
| 54 | + (ns test.crypt |
| 55 | + (:require [goog.crypt :as c])) |
| 56 | + (c/stringToByteArray "ClojureScript") |
| 57 | + |
| 58 | + (load-namespace 'goog.date.Date) |
| 59 | + (goog.date.Date.) |
65 | 60 |
|
66 | 61 | )
|
0 commit comments