Clean component.cljs up

This commit is contained in:
Dan Holmsand 2013-12-19 19:28:35 +01:00
parent 45c32d9f61
commit 0d44dc34bc
1 changed files with 3 additions and 7 deletions

View File

@ -54,8 +54,7 @@
;; tricky. The upside is that we don't have to do any allocations.
(defn- args-of [C]
(-> C (aget "props") .-cljsArgs)
#_(-> C .-props .-cljsArgs))
(-> C (aget "props") .-cljsArgs))
(defn- props-in-args [args]
(let [p (nth args 1 nil)]
@ -95,7 +94,7 @@
;;; Function wrapping
(defn- do-render [C f]
(let [res (f (cljs-props C) C (aget "state" C) #_(.-state C))
(let [res (f (cljs-props C) C (.-state C))
conv (if (vector? res)
(tmpl/as-component res)
(if (fn? res)
@ -121,8 +120,7 @@
;; reset! doesn't call -notifyWatches unless -watches is set
(set! (.-watches C) {})
(when f
(set! (.-cljsOldState C) (merge (aget "state" C)
#_(.-state C) (f C)))))
(set! (.-cljsOldState C) (merge (.-state C) (f C)))))
:componentWillReceiveProps
(fn [C props]
@ -161,8 +159,6 @@
f))
(defn- get-wrapper [key f name]
;; (when (and name (fn? f) (nil? (aget f "displayName")))
;; (aset f "displayName" (str name key)))
(let [wrap (custom-wrapper key f)]
(when (and wrap f)
(assert (fn? f)