This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-03-30
Channels
- # announcements (8)
- # babashka (102)
- # beginners (312)
- # calva (9)
- # clj-kondo (9)
- # cljfx (7)
- # clojure (128)
- # clojure-europe (52)
- # clojure-nl (2)
- # clojure-norway (2)
- # clojure-spec (5)
- # clojure-uk (4)
- # clojurescript (13)
- # conjure (5)
- # cursive (5)
- # datalog (18)
- # datomic (8)
- # emacs (1)
- # events (3)
- # fulcro (16)
- # graphql (2)
- # gratitude (1)
- # helix (16)
- # inf-clojure (17)
- # introduce-yourself (9)
- # java (11)
- # lambdaisland (3)
- # leiningen (3)
- # lsp (8)
- # malli (3)
- # membrane (7)
- # missionary (26)
- # nextjournal (1)
- # off-topic (19)
- # pathom (3)
- # polylith (13)
- # portal (16)
- # reagent (39)
- # reitit (2)
- # releases (23)
- # remote-jobs (1)
- # shadow-cljs (40)
- # specter (3)
- # sql (12)
- # tools-deps (8)
- # tree-sitter (1)
- # vim (3)
- # web-security (6)
- # xtdb (16)
I'm noticing js objects are a bit unwieldy to visualize in portal. Is there anything that could be done @djblue?
You could register something like https://github.com/djblue/portal/blob/master/examples/web/dev/user.cljs#L10-L13 as a command 👌
I was trying with:
(defn obj->clj
[obj]
(if (goog.isObject obj)
(-> (fn [result key]
(let [v (goog.object/get obj key)]
(if (= "function" (goog/typeOf v))
result
(assoc result key (obj->clj v)))))
(reduce {} (.getKeys goog/object obj)))
obj))
from the same answer, but it still remains unwieldyMainly the fact that I continue to get opaque representations like:
#object[malli.core.t_malli$core61795]
instead of honest-to-god maps 😂this is the partially translated structure:
{:args [2 3],
:schema #object[malli.core.t_malli$core61795],
:value "abcd",
:output #object[malli.core.t_malli$core61451]}
I guess I want something like:
(extend-protocol Datafiable
js/KeyboardEvent
(datafy [this] (js->clj+ this)))
but where do I find the name of the object? (like js/KeyboardEvent
here)something like this https://github.com/metosin/malli/blob/master/src/malli/core.cljc#L28-L41 ?