This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-12-21
Channels
- # aatree (5)
- # admin-announcements (3)
- # beginners (13)
- # boot (25)
- # cider (4)
- # cljs-dev (2)
- # clojure (107)
- # clojure-austria (2)
- # clojure-japan (12)
- # clojure-russia (128)
- # clojurebridge (2)
- # clojurecup (32)
- # clojurescript (68)
- # css (4)
- # cursive (3)
- # datascript (4)
- # datomic (8)
- # devcards (25)
- # hoplon (19)
- # immutant (2)
- # ldnclj (4)
- # liberator (2)
- # luminus (5)
- # off-topic (184)
- # om (78)
- # onyx (2)
- # portland-or (11)
- # re-frame (27)
- # reagent (11)
- # yada (3)
I’ve been trying to make a devcard for an Om component, but it requires a target element. I’ve tried to use the dom-node
macro. Anybody know how to pass it to Om? Here’s my code:
(defcard-om campaign-countdown
(om/root timer/countdown-timer timer-state
{:target (dom-node)}))
@sventechie: Hi Sven, see this:
(defcard
(om/mock-root reconciler YourDataScriptBackedComponent))
Another example, less powerful:
(def input-nam-letters (om/factory InputNamLetters))
(defcard
(fn [init-data _]
(input-nam-letters @init-data))
{:nam-letters "Blah"}
{:inspect-data true
:history true})
Hmm, I still get the error: "Card has not mounted DOM node."
In both cases I didn't need to pass the target node (but I may have misundestood your need on that level)
What version of devcards?
Mine: 0.2.1-2
OK, looks like maybe you’re using om.next
?
oh, yes, sorry! And I never used Om.current
I’m trying to integrate this example countdown timer: http://madhuvishy.in/posts/2014/04/devlog-week-9-getting-started-with-om.html
I’d be happy to port it to om.next
but not sure how involved that’d be.
Here’s the source: https://github.com/madhuvishy/cheating-countdown/blob/master/src/cheating_countdown/core.cljs
ok, then try
(defcard-om campaign-countdown
(fn [init-data node]
(om/root timer/countdown-timer timer-state
{:target node})))
Also look at Bruce's examples: https://github.com/bhauman/devcards/blob/master/example_src/devdemos/om.cljs http://rigsomelight.com/devcards/#!/devdemos.om
Yeah, I looked at Bruce’s examples but he never uses the macros I think I’d need.
I’m still getting "Card has not mounted DOM node.” with your example.
Where did you get the argument list?
Found it back from the github repo's README: http://rigsomelight.com/devcards/#!/devdemos.defcard_api
Also check the bottom of the page.
Hmm, thanks, Google searches did not turn up those documents.
node
appears to be a React element, rather than a DOM element. I wonder if that’s a problem.
ok so the bottom of that page will tell you how to reach a DOM element.
Note: I haven't looked at if you really need the low-level of a DOM element for that counter.
Thanks! I’m asking the more general question in the #om
channel now.
No problem!