mirror of https://github.com/status-im/reagent.git
Use deftype constrcutor functions instead of interop, replaces #144
This commit is contained in:
parent
19ae267b32
commit
82c4013a29
|
@ -10,7 +10,7 @@
|
||||||
(y [_] y-coord))
|
(y [_] y-coord))
|
||||||
|
|
||||||
(defn point [x y]
|
(defn point [x y]
|
||||||
(Point. x y))
|
(->Point x y))
|
||||||
|
|
||||||
(defn dist [p1 p2]
|
(defn dist [p1 p2]
|
||||||
(js/Math.sqrt (+ (js/Math.pow (- (x p2) (x p1)) 2)
|
(js/Math.sqrt (+ (js/Math.pow (- (x p2) (x p1)) 2)
|
||||||
|
|
|
@ -86,7 +86,7 @@
|
||||||
(run-queue cs))
|
(run-queue cs))
|
||||||
(.flush-after-render this)))
|
(.flush-after-render this)))
|
||||||
|
|
||||||
(defonce render-queue (RenderQueue. false))
|
(defonce render-queue (->RenderQueue false))
|
||||||
|
|
||||||
(defn flush []
|
(defn flush []
|
||||||
(.flush-queues render-queue))
|
(.flush-queues render-queue))
|
||||||
|
|
|
@ -254,7 +254,7 @@
|
||||||
($ util/react createElement c jsprops)))
|
($ util/react createElement c jsprops)))
|
||||||
|
|
||||||
(defn adapt-react-class [c]
|
(defn adapt-react-class [c]
|
||||||
(doto (NativeWrapper.)
|
(doto (->NativeWrapper)
|
||||||
($! :name c)
|
($! :name c)
|
||||||
($! :id nil)
|
($! :id nil)
|
||||||
($! :class nil)))
|
($! :class nil)))
|
||||||
|
|
|
@ -162,8 +162,8 @@
|
||||||
|
|
||||||
(defn atom
|
(defn atom
|
||||||
"Like clojure.core/atom, except that it keeps track of derefs."
|
"Like clojure.core/atom, except that it keeps track of derefs."
|
||||||
([x] (RAtom. x nil nil nil))
|
([x] (->RAtom x nil nil nil))
|
||||||
([x & {:keys [meta validator]}] (RAtom. x meta validator nil)))
|
([x & {:keys [meta validator]}] (->RAtom x meta validator nil)))
|
||||||
|
|
||||||
|
|
||||||
;;; track
|
;;; track
|
||||||
|
@ -306,7 +306,7 @@
|
||||||
(not (vector? src))))
|
(not (vector? src))))
|
||||||
(str "src must be a reactive atom or a function, not "
|
(str "src must be a reactive atom or a function, not "
|
||||||
(pr-str src)))
|
(pr-str src)))
|
||||||
(RCursor. src path nil nil nil))
|
(->RCursor src path nil nil nil))
|
||||||
|
|
||||||
|
|
||||||
;;; with-let support
|
;;; with-let support
|
||||||
|
@ -486,7 +486,7 @@
|
||||||
|
|
||||||
|
|
||||||
(defn make-reaction [f & {:keys [auto-run on-set on-dispose]}]
|
(defn make-reaction [f & {:keys [auto-run on-set on-dispose]}]
|
||||||
(let [reaction (Reaction. f nil true false nil nil nil nil)]
|
(let [reaction (->Reaction f nil true false nil nil nil nil)]
|
||||||
(._set-opts reaction {:auto-run auto-run
|
(._set-opts reaction {:auto-run auto-run
|
||||||
:on-set on-set
|
:on-set on-set
|
||||||
:on-dispose on-dispose})
|
:on-dispose on-dispose})
|
||||||
|
@ -563,8 +563,8 @@
|
||||||
(-pr-writer [a w opts] (pr-atom a w opts "Wrap:")))
|
(-pr-writer [a w opts] (pr-atom a w opts "Wrap:")))
|
||||||
|
|
||||||
(defn make-wrapper [value callback-fn args]
|
(defn make-wrapper [value callback-fn args]
|
||||||
(Wrapper. value
|
(->Wrapper value
|
||||||
(util/partial-ifn. callback-fn args nil)
|
(util/->partial-ifn callback-fn args nil)
|
||||||
false nil))
|
false nil))
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue