From d30ef3aedb6edb9d3df735d8d360ff6a76029887 Mon Sep 17 00:00:00 2001 From: Dan Holmsand Date: Fri, 9 Oct 2015 14:41:03 +0200 Subject: [PATCH] Make copying of watches in ratom a little faster --- src/reagent/ratom.cljs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/reagent/ratom.cljs b/src/reagent/ratom.cljs index f3b8ea3..ea45d32 100644 --- a/src/reagent/ratom.cljs +++ b/src/reagent/ratom.cljs @@ -74,7 +74,8 @@ (let [w (.-watchesArr this) a (if (nil? w) ;; Copy watches to array for speed - (->> this .-watches seq flatten into-array + (->> (.-watches this) + (reduce-kv #(doto %1 (.push %2) (.push %3)) #js[]) (set! (.-watchesArr this))) w)] (let [len (alength a)]