Make conversion to js a tiny bit faster

This commit is contained in:
Dan Holmsand 2014-01-02 11:18:00 +01:00
parent 30f9681d4e
commit cb60a6094f
1 changed files with 12 additions and 10 deletions

View File

@ -126,17 +126,19 @@
wrapper
(fn-to-class x)))))
(defn vec-to-comp [x]
(let [[tag p] x
(defn vec-to-comp [v]
(let [[tag props] v
c (.-cljsReactClass (as-class tag))
a (js-obj)]
(set! (.-cljsArgs a) x)
(when (map? p)
(when-let [key (:key p)]
(set! (.-key a) key))
(when-let [ref (:ref p)]
(set! (.-ref a) ref)))
(c a)))
obj (js-obj)]
(set! (.-cljsArgs obj) v)
(when (map? props)
(let [key (:key props)]
(when-not (nil? key)
(set! (.-key obj) key)))
(let [ref (:ref props)]
(when-not (nil? ref)
(set! (.-ref obj) ref))))
(c obj)))
(defn map-into-array [f coll]
(let [a (into-array coll)