mirror of
https://github.com/penpot/penpot.git
synced 2026-01-21 12:50:11 -05:00
Compare commits
2 Commits
develop
...
niwinz-dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
33a174adf5 | ||
|
|
545a558812 |
@@ -172,6 +172,9 @@
|
||||
schema-1 (c/get params :schema-1)
|
||||
this? (c/get params :this false)
|
||||
|
||||
decode-options
|
||||
(c/get params :decode-options)
|
||||
|
||||
fn-sym
|
||||
(-> (gensym (str "internal-fn-" (str/slug pname) "-"))
|
||||
(with-meta {:tag 'function}))
|
||||
@@ -198,13 +201,28 @@
|
||||
get-expr)])
|
||||
|
||||
(when set-expr
|
||||
[(make-sym pname "set-fn")
|
||||
(if this?
|
||||
`(fn [v#]
|
||||
(let [~this-sym (~'js* "this")
|
||||
~fn-sym ~set-expr]
|
||||
(.call ~fn-sym ~this-sym ~this-sym v#)))
|
||||
set-expr)])
|
||||
(concat
|
||||
(when schema-n
|
||||
[coercer-sym `(sm/coercer ~schema-n)])
|
||||
|
||||
[(make-sym pname "set-fn")
|
||||
(if this?
|
||||
`(fn [~'v]
|
||||
(let [~this-sym (~'js* "this")
|
||||
~fn-sym ~set-expr
|
||||
~'v (json/->clj ~'v ~decode-options)
|
||||
~'v ~(if schema-n
|
||||
`(~coercer-sym ~'v)
|
||||
'v)]
|
||||
(.call ~fn-sym ~this-sym ~this-sym ~'v)))
|
||||
`(fn [~'v]
|
||||
(let [~this-sym (~'js* "this")
|
||||
~fn-sym ~set-expr
|
||||
~'v (json/->clj ~'v ~decode-options)
|
||||
~'v ~(if schema-n
|
||||
`(~coercer-sym ~'v)
|
||||
'v)]
|
||||
(.call ~fn-sym ~this-sym ~'v))))]))
|
||||
|
||||
(when fn-expr
|
||||
(concat
|
||||
@@ -223,14 +241,14 @@
|
||||
|
||||
~@(if schema-1
|
||||
[fn-sym `(fn* [param#]
|
||||
(let [param# (json/->clj param#)
|
||||
(let [param# (json/->clj param# ~decode-options)
|
||||
param# (~coercer-sym param#)]
|
||||
(~fn-sym param#)))]
|
||||
[])
|
||||
~@(if schema-n
|
||||
[fn-sym `(fn* []
|
||||
(let [params# (into-array (cljs.core/js-arguments))
|
||||
params# (mfu/bean params#)
|
||||
params# (json/->clj params# ~decode-options)
|
||||
params# (~coercer-sym params#)]
|
||||
(apply ~fn-sym params#)))]
|
||||
[])
|
||||
|
||||
Reference in New Issue
Block a user