This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-10-31
Channels
- # aws-lambda (4)
- # beginners (152)
- # boot (19)
- # cider (45)
- # cljs-dev (14)
- # clojure (54)
- # clojure-dev (33)
- # clojure-greece (11)
- # clojure-italy (4)
- # clojure-nl (8)
- # clojure-norway (2)
- # clojure-russia (6)
- # clojure-sg (1)
- # clojure-spec (1)
- # clojure-uk (40)
- # clojure-ukraine (5)
- # clojurescript (40)
- # community-development (13)
- # component (8)
- # core-async (3)
- # cursive (25)
- # data-science (11)
- # datomic (13)
- # duct (1)
- # emacs (2)
- # events (16)
- # figwheel (3)
- # fulcro (53)
- # graphql (2)
- # jobs (5)
- # jobs-rus (1)
- # juxt (10)
- # leiningen (4)
- # off-topic (82)
- # other-languages (5)
- # portkey (3)
- # protorepl (13)
- # re-frame (22)
- # reagent (15)
- # ring-swagger (4)
- # shadow-cljs (69)
- # spacemacs (7)
- # specter (16)
- # sql (13)
- # vim (5)
- # yada (2)
When using :process-shim
, env.js
is created but it's loaded way after most of other JS files which causes multiple process is not defined
errors in my case.
Is it something that's easy to fix?
@xiongtx It depends on which REPL you are in and how it handles printing. Lumo and Planck behave like your Clojure example.
You can force the issue by using something like (with-out-str (doseq [x [1 2 3]] (cljs.pprint/cl-format true "~A" x)))
You can see it is just a REPL/extra-newline issue by looking at the behavior of pr
with (do (pr 1) (pr 2) (pr 3))
So apparently the documentation at https://clojurescript.org/reference/compiler-options#preloads is a bit misleading in saying that :preloads
work right after cljs.core
is loaded.
:preloads
are included right after all dependencies have been loaded. And many libraries in NPM check process.env
during loading. Hence, it's impossible to set process.env
using only preloads in such a way so that no libraries break.
Ok, got it working. For everybody wondering, it was the Vagrant shared folder: https://stackoverflow.com/questions/37493061/figwheel-not-hot-reloading-or-updating-on-file-save-when-using-vagrant
I’ve used clojurescript for a long time, but I’m still not really comfortable with externs.
how does one go about debugging externs problems? for example the leaflet map extern has addControl
method, but in my project calls to it are still getting munged
Turning on pseudo-names
for debugging the compiled code. Externs Inference (https://clojurescript.org/guides/externs) to try and debug things during compile time.
I ended up using https://github.com/binaryage/cljs-oops for this.
Hello All - brand new CLJS n00b here… I am using reagent, and I can get some basics sorted, but I have two questions… 1. Can I make the target of an onclick be a CLJS function that will grab some data, hide a section and then initialize the same section with a new component? 2. Is there a good way to separate the functionality / logic from the components, or do I need to just accept that the logic and presentation are a bit colocated?
I'm trying to use https://github.com/souporserious/react-measure in my project. I specified the dependency using :npm-deps
, and everything is fine up to the moment when I actually try to render the wrapped component:
Uncaught TypeError: _resizeObserverPolyfill2$$module$home$p_himik$dev$git$musicxmlcheck_test$node_modules$react_measure$lib$with_content_rect.default is not a constructor
The check of the objects quickly shows that it's being wrapped by _interopRequireDefault
into {default: ...}
two times:
_resizeObserverPolyfill2$$module$home$p_himik$dev$git$musicxmlcheck_test$node_modules$react_measure$lib$with_content_rect: Object
default:
default: λ[callback]
Has anyone seen anything like it?@maleghast Regarding your second question, you can check out re-frame
library. For me it works great.
@p-himik Thanks for the tip, I may indeed look at re-frame, but right now, I need to get some stuff working…
@jgreen I successfully used Highcharts: https://www.highcharts.com/demo/sparkline The library itself is not react-like, but it's easy to make it work in a component.
http://recharts.org is also a nice charting lib for react
but there seems to be at least a couple of react sparkline libs (by quick google search), don’t they work?
if you just use a small linechart without a grid or axis, that should basically be the same as a sparkline
I am confused:
cljs.user> (pos? "3")
---- Compiler Warning on <cljs form> line:1 column:1 ----
cljs.user> (#(pos? %) "3")
true
cljs.user> (#(pos? %) "-3")
false
Can anyone help me understand what's going on there?@eggsyntax pos?
is both a function and a macro
in the first snippet you’re calling the macro, which can statically verify you’re not passing it a number
the other snippets are calling the function and the string gets implicitly casted to a number which is why it works
(casted by the underlying JS host, I should say)
Gotcha, thanks @anmonteiro. I was worried it was some sort of Halloween spookiness.
@anmonteiro can you tell me where to find info on that dual existence as function and macro? I assume it's not unique to pos?
, and would like to understand it better.
I'm guessing that's
(core/defmacro ^::ana/numeric pos? [x]
`(> ~x 0))
in cljs.core.cljc
.and the function is in cljs/core.cljs
@eggsyntax If you are interested in the subject of ClojureScript Vars that can be both macros and functions, here is a post on it: http://blog.fikesfarm.com/posts/2015-12-12-clojurescript-macro-functions.html
Terrific, thanks! I'll go read through it right now. I've gotten closer to understanding it just by digging through the code & reading the brief mentions on https://clojurescript.org/about/differences , but it's still pretty shaky...
Hi, has anyone played with options for server-side rendering a reagent + re-frame app? Is https://prerender.cloud a good option?