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))
|
||||
|
||||
(defn point [x y]
|
||||
(Point. x y))
|
||||
(->Point x y))
|
||||
|
||||
(defn dist [p1 p2]
|
||||
(js/Math.sqrt (+ (js/Math.pow (- (x p2) (x p1)) 2)
|
||||
|
|
|
@ -86,7 +86,7 @@
|
|||
(run-queue cs))
|
||||
(.flush-after-render this)))
|
||||
|
||||
(defonce render-queue (RenderQueue. false))
|
||||
(defonce render-queue (->RenderQueue false))
|
||||
|
||||
(defn flush []
|
||||
(.flush-queues render-queue))
|
||||
|
|
|
@ -254,7 +254,7 @@
|
|||
($ util/react createElement c jsprops)))
|
||||
|
||||
(defn adapt-react-class [c]
|
||||
(doto (NativeWrapper.)
|
||||
(doto (->NativeWrapper)
|
||||
($! :name c)
|
||||
($! :id nil)
|
||||
($! :class nil)))
|
||||
|
|
|
@ -162,8 +162,8 @@
|
|||
|
||||
(defn atom
|
||||
"Like clojure.core/atom, except that it keeps track of derefs."
|
||||
([x] (RAtom. x nil nil nil))
|
||||
([x & {:keys [meta validator]}] (RAtom. x meta validator nil)))
|
||||
([x] (->RAtom x nil nil nil))
|
||||
([x & {:keys [meta validator]}] (->RAtom x meta validator nil)))
|
||||
|
||||
|
||||
;;; track
|
||||
|
@ -306,7 +306,7 @@
|
|||
(not (vector? src))))
|
||||
(str "src must be a reactive atom or a function, not "
|
||||
(pr-str src)))
|
||||
(RCursor. src path nil nil nil))
|
||||
(->RCursor src path nil nil nil))
|
||||
|
||||
|
||||
;;; with-let support
|
||||
|
@ -486,7 +486,7 @@
|
|||
|
||||
|
||||
(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
|
||||
:on-set on-set
|
||||
:on-dispose on-dispose})
|
||||
|
@ -563,8 +563,8 @@
|
|||
(-pr-writer [a w opts] (pr-atom a w opts "Wrap:")))
|
||||
|
||||
(defn make-wrapper [value callback-fn args]
|
||||
(Wrapper. value
|
||||
(util/partial-ifn. callback-fn args nil)
|
||||
(->Wrapper value
|
||||
(util/->partial-ifn callback-fn args nil)
|
||||
false nil))
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue