minor
This commit is contained in:
parent
3e3db8ed6d
commit
97369859dd
1 changed files with 6 additions and 7 deletions
|
|
@ -1,11 +1,10 @@
|
||||||
(ns scittle.core
|
(ns scittle.core
|
||||||
(:refer-clojure :exclude [defn time])
|
(:refer-clojure :exclude [time])
|
||||||
(:require [clojure.core :as c]
|
(:require [goog.object :as gobject]
|
||||||
[goog.object :as gobject]
|
|
||||||
[goog.string]
|
[goog.string]
|
||||||
[sci.core :as sci]))
|
[sci.core :as sci]))
|
||||||
|
|
||||||
(c/defmacro time
|
(defmacro time
|
||||||
"Evaluates expr and prints the time it took. Returns the value of expr."
|
"Evaluates expr and prints the time it took. Returns the value of expr."
|
||||||
[expr]
|
[expr]
|
||||||
`(let [start# (cljs.core/system-time)
|
`(let [start# (cljs.core/system-time)
|
||||||
|
|
@ -29,14 +28,14 @@
|
||||||
:classes {'js js/window
|
:classes {'js js/window
|
||||||
:allow :all}})))
|
:allow :all}})))
|
||||||
|
|
||||||
(c/defn ^:export eval-string [s]
|
(defn ^:export eval-string [s]
|
||||||
(sci/eval-string* @ctx s))
|
(sci/eval-string* @ctx s))
|
||||||
|
|
||||||
(c/defn register-plugin! [plug-in-name sci-opts]
|
(defn register-plugin! [plug-in-name sci-opts]
|
||||||
plug-in-name ;; unused for now
|
plug-in-name ;; unused for now
|
||||||
(swap! ctx sci/merge-opts sci-opts))
|
(swap! ctx sci/merge-opts sci-opts))
|
||||||
|
|
||||||
(c/defn- load-contents [script-tags]
|
(defn load-contents [script-tags]
|
||||||
(when-let [tag (first script-tags)]
|
(when-let [tag (first script-tags)]
|
||||||
(if-let [text (not-empty (gobject/get tag "textContent"))]
|
(if-let [text (not-empty (gobject/get tag "textContent"))]
|
||||||
(do (eval-string text)
|
(do (eval-string text)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue