This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-05-25
Channels
- # aws (2)
- # beginners (57)
- # boot (31)
- # carry (15)
- # cider (9)
- # cljs-dev (9)
- # cljs-experience (32)
- # cljsrn (94)
- # clojure (129)
- # clojure-dusseldorf (3)
- # clojure-greece (4)
- # clojure-italy (8)
- # clojure-norway (3)
- # clojure-russia (344)
- # clojure-sg (39)
- # clojure-spec (2)
- # clojure-uk (39)
- # clojurescript (84)
- # core-async (99)
- # cursive (10)
- # data-science (1)
- # datascript (4)
- # datomic (66)
- # emacs (10)
- # graphql (4)
- # hoplon (28)
- # jobs (15)
- # luminus (3)
- # lumo (5)
- # off-topic (23)
- # om (4)
- # onyx (32)
- # pedestal (24)
- # re-frame (2)
- # reagent (7)
- # ring-swagger (32)
- # spacemacs (4)
- # untangled (57)
- # utah-clojurians (1)
Hi. Playing around with colocated-css queries. In development mode and simple optimisations when i do (pr-str Component)
I get a string namespace/Component
but with advanced optimisations I get #object[$U "function (){React.Component.apply(this,arguments);this.state=null!=
.
Has anyone encountered this, is there another way to get namespace/Component
with advanced optimisations ?
@claudio the code that makes that works seems to get removed by :advanced
. not sure if intended or bug
Hi, hoping someone can just point me in the right direction here, I don't seem to be searching in the right direction: trying to use cljsjs/pdf.js with re-frame/figwheel, no problem requiring the library itself or invoking functions on it, but this particular library tries to retrieve an additional file (when using figwheel) http://localhost:3000/js/compiled/out/cljsjs/pdfjs/common/pdf.inc.worker.js, the pdf.inc.worker.js is in the cljsjs/pdf.js bundle but clearly not where pdf.js expects to find it. There is a property in PDFJS that can bet set for the workerSrc url but its not clear what it should be set to. Cheers
@claudiu I believe this is a bug[1] in CLJS, see point #1, you seem to be printing a constructor name which does not work under :advanced
https://dev.clojure.org/jira/browse/CLJS-1249
as a workaround you could be able to invoke (.cljs$lang$ctorPrWriter obj obj writer opts)
by hand, see the relevant code
@frank https://google.github.io/closure-library/api/goog.object.html should have everything you need
in js, you'd use the delete operator as shown here: https://stackoverflow.com/questions/208105/how-do-i-remove-a-property-from-a-javascript-object
the reason I'm asking is because js->clj
seems to throw when passed js objects with the "v"
key, but only when the code is advanced compiled
I am running into a problem where (.createElement js/document "svg") returns #object[HTMLUnknownElement [object HTMLUnknownElement]] and cannot be added to the DOM using .appendChild
running JS: document.createElement("svg") in the console returns a svg node, as I'd expect
I’m having an interop problem. I have a js prototype object, with a field that take a function ref, e.g. :observer 'foo'
. I want to delegate to a cljs namespace, e.g. :observer acme.widgets/foo-observer
. I use clj->js to convert the prototype object. I’ve tried various ways to do this (including using _ instead of -) and can’t get it to work, i get “method not defined”. but it looks like it is defined, all the namespaces are correct, and goog.required etc.
so i guess the short version is: how can I pass a reference to a cljs fn in a prototype object that is converted using clj->js?
re: my problem above, I actually managed to add the svg node to the DOM despite the HTMLUnknownElement type, when I run the command directly in figwheel.
(r/create-class {:component-did-mount (partial jaeger/postload state) :component-did-update (partial jaeger/postload state) :reagent-render (fn [] (side-by-side state jaeger/render))})
where state is a reagent atom and postload is the function that should create/add the svg node
I can confirm via printing that postload is getting called, and appendChild is running
Is there some trigger I am missing besides component-did-mount and component-did-update? Something that runs afterwards that is removing my changes?
@dnolen Are there any gotchas I should worry about removing the first three cases from js->clj? https://dev.clojure.org/jira/browse/CLJS-2050?focusedCommentId=45719#comment-45719. It seems like it would be fine if we are just using it for json parsing, but wanted to double check.
just trying to imagine in what scenarios i would have clojure objects inside my js objects?
@iandavis many people are not so careful, sometimes people put stuff in to roundtrip through some JS api etc.
anyways I think adding more cases to js->clj
was a terrible idea and should have pushed back on that more
if I have any compalint about the clojures, it’s that sometimes people can be not so careful
one option would be to move it to a deprecated ns and put a more disciplined one in place
and despite the harrowing route I had to go down to track down the root cause, i know a lot more about the guts of cljs now which is nice
@iandavis I will say your problem is a sign of a wider problem - we might want cljs$lang$type
property to be a sentinel instead of a boolean
and then protect protocol bitmask checks with a CLJS type test - but need to benchmark to see how much of a hit that would be
Hi all - question, is cljs.reader/read-string
safe for receiving arbitrary client data?
@djtango probably yes, https://github.com/clojure/clojurescript/blob/master/src/main/cljs/cljs/reader.cljs#L455
oh - it looks like #= doesn’t exist for cljs.reader
yep, https://github.com/clojure/clojurescript/blob/master/src/main/cljs/cljs/reader.cljs#L421-L449
is there a simple way to take some data in my clojurescript app in dev and store it on disk? I’m using figwheel if that makes it easier
on disk as in another process or a unit test could grab the data and use it
@noisesmith not exactly simple, but... https://stackoverflow.com/questions/3665115/create-a-file-in-memory-for-user-to-download-not-through-server
OK yeah I already use data URIs, so I guess I need to add a dom node to my app in the browser for the href
oh wait that example calls click right…
@john cool this works https://gist.github.com/noisesmith/28f61a165d044ce45a82935f04d61946
I think I've heard folks ask that same question twice recently. That gist should be helpful.
thinking of using it to make a cljs ns for poirot https://github.com/noisesmith/poirot/ which is for lowering friction to creating data based unit tests using data that is already in your running app
@john a bridge, I find that my team is great at playing in the repl to get things working, but not so great at turning those repl experiments into tests that we can run automatically
the hope with this library is to make it easier to say “OK - I know how this works in the repl, better make some unit tests to document and automate my assumptions”
because when someone else comes back months later, they don’t know what you did in the repl to prove this function worked!
so how do they know that their change to the function makes sense? etc.
@noisesmith You can also do interesting things with fileReader. I believe there is a way to incrementally read and write to a user provided file. https://stackoverflow.com/questions/14842214/html5-filereader-how-to-only-read-the-first-n-characters-of-a-file
yeah - I’m looking at how to do the other side of the conversion too (load test data into a repl)
@john yeah I’ve been encouraging the team to use the tool, and once we get some good experience using it and any weirdness ironed out I’ll publicize it a bit
I’ll probably make custom readers for things like atoms and js-bigint thingies that show up in a lot of our cljs data that we would want to round trip