This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-07-19
Channels
- # admin-announcements (2)
- # aws-lambda (3)
- # beginners (66)
- # boot (61)
- # cider (1)
- # cljs-dev (17)
- # clojure (100)
- # clojure-austin (4)
- # clojure-brasil (1)
- # clojure-canada (8)
- # clojure-quebec (6)
- # clojure-russia (48)
- # clojure-sg (6)
- # clojure-spec (37)
- # clojure-uk (61)
- # clojure-ukraine (2)
- # clojurescript (80)
- # core-async (13)
- # cursive (20)
- # datascript (37)
- # datomic (2)
- # defnpodcast (4)
- # emacs (5)
- # funcool (3)
- # hoplon (11)
- # jobs (7)
- # juxt (26)
- # lein-figwheel (48)
- # leiningen (3)
- # luminus (3)
- # om (34)
- # om-next (5)
- # onyx (5)
- # protorepl (6)
- # re-frame (10)
- # reagent (9)
- # rethinkdb (16)
- # ring-swagger (5)
- # spacemacs (14)
- # specter (54)
- # untangled (36)
- # vim (75)
- # yada (1)
links is a vector of node to node connections, and i need links to contain a pointer to the node as the node’s x and y values changes
what happens when i declare a new link is that it just uses the current value of x and y, and doesn’t update when the node’s coordinates change
i’m not even sure that pointers are the right term to use, and i haven’t been getting good results from searching “clojurescript pointers"
reference is the term you’re talking about in a jvm language
when using om, you have one atom that has app state
what you need to keep is the path to that node
the path is data
then in your component, the render function should continue to update as you change the app state
are you updating the appstate as the node changes?
but the link’s reference to the node x is still the same (actually it does change, but at some point it stops reflecting the current value)
what are you doing in your IDidUpdate handler
i have the code here: https://github.com/xtrntr/cljs-d3/blob/master/src/cljs/cljs_d3/core.cljs
that’s helpful!
the uncommented (.log js/console ..) is the part where i can see the link reference to the node is not the same
are you seeing your IDidUpdate being called?
there are printlns littered there, and they’re called just about the same as the tick function initialized in IDidMount
thanks for telling me the right term is reference, but it seems like i need to be a little clever about googling the right terms - all i’m getting is API/documentation hits 😅
You aren’t looking for the term cursor are you?
glad you got it working. Ugly is merely a first step to good
and getting it to work is sometimes an impediment to understanding, because after spending hours on this i’m not sure i want to spend more time getting to understand this
that’s what other days are for
apparently, after an event that adds a node to the state, i have to reinitialize the links with the same declarations
what i meant is at the start i do this: (om/set-state! owner :links (clj->js [{:source (get-node owner 0) :target (get-node owner 1) :left false :right true} {:source (get-node owner 1) :target (get-node owner 2) :left false :right true}]))
it obviously won’t scale if i add new functionality to add new links, but i can use this to figure out what’s going on at least
thanks @mj_langford 🙂
I do very little om, but glad I was at least a 🦆
@anmonteiro, for me, the jsdoc is only emitted when defined with the function in the protocol and not in the implementation. maybe i am doing something wrong.
here is the code I tested with:
(defprotocol P
(^{:jsdoc ["@type {*}"]} foo [this])
(bar-me [this]))
(deftype Foo [a b c]
P
(^{:jsdoc ["@type {*}"]} foo [this] a)
(bar-me [this] b))
there's some weird bug(?) that I've just experience. when I name a wrapper namespace of cljsjs.mousetrap
, called my.cljsjs.mousetrap
, and I require my.cljsjs.mousetrap
in someplace like cljs.user
, then every Var inside my.cljsjs.mousetrap
is undeclared, can't be used. any idea? is this another namespace clash issue?
I don't quite understand what you mean by "when I name a wrapper namespace of cljsjs.mousetrap
, called my.cljsjs.mousetrap
"?
and you def
something in my.cljsjs.mousetrap
and you cannot use it as (mousetrap/something)
?
I'm preparing a .cljs
file for transition to .cljc
. In the .cljs
I find (when ^boolean js/goog.DEBUG ...
and I'm wondering how to transform that ... what's the standard way in clojure to know about production vs development builds? (I know almost nothing of the java/clojure world). Is there a direct translation or is it complicated?
@ajchemist: that should not be a problem, are there any warnings generated anywhere?
---- Compiler Warning on <cljs form> line:1 column:1 ----
Use of undeclared Var my.cljsjs.mousetrap/boot!
1 mousetrap/boot!
^---
---- Compiler Warning ----
@mikethompson: clojure does not make a distinction between production and development
(defn ^:export boot! []
(when (and (exists? js/Mousetrap)
(oget js/Mousetrap "prototype" "handleKey"))
(oset js/Mousetrap "prototype" "handleKey" handle-key)
(mlog/debug "js/Mousetrap has booted.")))
@mikethompson: clojure can have aot
, direct-linking
and elide-meta
optimization for production I think.
@mikethompson: you want something like environment variables or something you set up yourself
okay thanks. Yeah, I guess I'm wondering what method is used when you want to remove code which belongs in dev builds but not in production
Okay, thanks
@ajchemist: not sure what is happening, looks ok from the snippets you showed
Have anyone mocked namespaces in clojurescript? I’m testing a re-frame
app in React Native and would like to test the business logic in node. RN needs a lot of babel transforms and stuff, so if I include any reference to code that includes require calls to RN the code does not work in node. Hence I would like to mock out the namespaces that call RN since I wont test them anyway. Any ideas?
@rohit: exactly, that's what I'm seeing too
@anmonteiro: it sort of makes sense to me. you always call the function in the protocol. it then delegates to the call to the particular function.
@rohit: there are some Closure directives like @nocollapse
that would make sense per implementation
@anmonteiro: actually don’t know enough about jsdocs to comment on that.
I'm thinking about adding a switch to figwheel, that will delete ns definitions in client memory that have been deleted from the original source file...
this could add much needed sanity to the dev process, in that things that reference deleted definitions will fail fast
This is normally caught by compiler warnings. But there are cases where you can still use deleted code without warning.
https://gist.github.com/SevereOverfl0w/4b173fad16e7d13b2210555604fda8f6 might be of interest to someone.