mirror of https://github.com/status-im/pluto.git
fix event metadata marker
Signed-off-by: Julien Eluard <julien.eluard@gmail.com>
This commit is contained in:
parent
8b612900ef
commit
45e4671ce2
|
@ -16,3 +16,4 @@ website/static/js/
|
||||||
website/static/extensions/
|
website/static/extensions/
|
||||||
\.\#*
|
\.\#*
|
||||||
.nrepl-port
|
.nrepl-port
|
||||||
|
*.lck
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
(cond (contains? values o) (get values o)
|
(cond (contains? values o) (get values o)
|
||||||
(symbol? o) nil
|
(symbol? o) nil
|
||||||
(string? o) (utils/interpolate values o)
|
(string? o) (utils/interpolate values o)
|
||||||
(and (fn? o) (= :event (meta o))) #(o % values) ;; Intercept events and inject the env. TODO remove this hack
|
(and (fn? o) (:event (meta o))) #(o % values) ;; Intercept events and inject the env. TODO remove this hack
|
||||||
:else o))
|
:else o))
|
||||||
|
|
||||||
(defn walkup-upto-leaf [f lp? lf tree]
|
(defn walkup-upto-leaf [f lp? lf tree]
|
||||||
|
|
|
@ -116,11 +116,13 @@
|
||||||
:else o))
|
:else o))
|
||||||
|
|
||||||
(defn event-after-env [ref data args bindings]
|
(defn event-after-env [ref data args bindings]
|
||||||
|
(with-meta
|
||||||
(fn [o env]
|
(fn [o env]
|
||||||
(let [env (merge env (reduce-kv #(assoc %1 (symbol (name %2)) %3) {} o)
|
(let [env (merge env (reduce-kv #(assoc %1 (symbol (name %2)) %3) {} o)
|
||||||
(:data (destructuring/destructure bindings (merge o args))))
|
(:data (destructuring/destructure bindings (merge o args))))
|
||||||
dic (reduce-kv #(assoc %1 %2 (if (contains? env %3) (get env %3) %3)) {} env)]
|
dic (reduce-kv #(assoc %1 %2 (if (contains? env %3) (get env %3) %3)) {} env)]
|
||||||
[ref (merge o (reduce-kv #(assoc %1 %2 (replace-atom dic %3)) {} data))])))
|
[ref (merge o (reduce-kv #(assoc %1 %2 (replace-atom dic %3)) {} data))]))
|
||||||
|
{:event true}))
|
||||||
|
|
||||||
(defn- reference-with-arguments [ctx ext ref event arguments args bindings]
|
(defn- reference-with-arguments [ctx ext ref event arguments args bindings]
|
||||||
(if arguments
|
(if arguments
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
(defn wrap-data [type data env o]
|
(defn wrap-data [type data env o]
|
||||||
(if (types/reference-types type)
|
(if (types/reference-types type)
|
||||||
(if (= :event type)
|
(if (= :event type)
|
||||||
(with-meta (fn [env o] (data env o)) :event)
|
(with-meta (fn [env o] (data env o)) {:event true})
|
||||||
data)
|
data)
|
||||||
data))
|
data))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue