This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-08-18
Channels
- # atom-editor (5)
- # babashka (15)
- # beginners (80)
- # calva (11)
- # cestmeetup (6)
- # chlorine-clover (15)
- # cider (22)
- # circleci (3)
- # clojure (57)
- # clojure-europe (19)
- # clojure-italy (1)
- # clojure-nl (4)
- # clojure-spec (1)
- # clojure-switzerland (1)
- # clojure-uk (88)
- # clojurescript (92)
- # code-reviews (1)
- # cursive (6)
- # data-science (5)
- # datascript (6)
- # datomic (12)
- # events (7)
- # figwheel-main (2)
- # fulcro (55)
- # graalvm (2)
- # helix (6)
- # juxt (6)
- # kaocha (11)
- # luminus (2)
- # off-topic (82)
- # pathom (27)
- # portal (1)
- # re-frame (3)
- # reitit (25)
- # remote-jobs (8)
- # sci (11)
- # shadow-cljs (29)
- # slack-help (2)
- # spacemacs (9)
- # specter (4)
- # sql (9)
- # tree-sitter (1)
- # uncomplicate (1)
- # xtdb (26)
I've got an issue with clojurescript sci, I'm trying to use d3.js as a :binding
in a function that sci compiled.
With d3.js it's normal to first grab a bunch of dom elements that you want to use and then apply some operations e.g.
(-> (.select d3 "body")
(.append "svg")
(.style "z-index" 30)
(.style "position" "absolute")
(.style "background" "tomato")
(.append "g")
(.call (-> (.brushX d3)
(.extent #js [#js [0 0] #js [400 200]])
(.on "brush" (fn [e] (js/console.log "brush" e)))
(.on "end" (fn [e] (js/console.log "ended brushing" e))))))
would select the body, append an svg with a brush element with listeners etc.
However as soon as .append gets called on the selection sci gives an error with:
this.select is not a function [at line 1, column 62]
Which is this source
https://github.com/d3/d3-selection/blob/master/src/selection/append.js#L5@bbss there is a fn? check in interpreter.cljc before the function gets called. Maybe sci is overly protective there. You could try to disable that check. I’m curious what the type of this thing is you are calling.
Ok, can you do more digging and make a small repro? Could also be a bug in the JS interop code
I was on 0.0.13-alpha.13
, updated to latest git version, fixed some warnings about .-
style property access by replacing it for goog.object/get
with reader :cljs
conditionals in impl/vars.cljc
and my problem is gone. Turns out just updating to latest version also works. Those warnings are probably just because I was using :local/root
and shadow-cljs warns more strictly for that.
well, I'm not sure why those warnings started happening, I think a newer version of clojurescript/closure compiler started be more restrictive in property access. But I don't know if that's necessary to fix and if the goog.object/get fix is the way to go. If it comes up for anyone give me a ping and I'll push what fixed it for me. Not much code.