This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-10-03
Channels
- # aleph (1)
- # beginners (42)
- # boot (34)
- # cider (157)
- # cljs-dev (12)
- # cljsrn (3)
- # clojure (165)
- # clojure-conj (1)
- # clojure-india (1)
- # clojure-italy (6)
- # clojure-russia (20)
- # clojure-spec (27)
- # clojure-uk (173)
- # clojurescript (116)
- # cursive (30)
- # datomic (87)
- # devcards (1)
- # docs (9)
- # emacs (2)
- # ethereum (2)
- # events (2)
- # fulcro (60)
- # graphql (10)
- # hoplon (2)
- # jobs-rus (6)
- # keechma (1)
- # lein-figwheel (9)
- # leiningen (36)
- # luminus (2)
- # mount (3)
- # off-topic (16)
- # om (14)
- # onyx (12)
- # pedestal (19)
- # portkey (107)
- # re-frame (9)
- # reagent (5)
- # ring (26)
- # shadow-cljs (149)
- # spacemacs (3)
- # sql (6)
I’m saying you wanna add that map to the foreign lib definition
as per the blog post
your generated package will be something like:
{:file "/path/to/enzyme.bundled.js"
:provides ["cljsjs.enzyme"]}
but I’m saying you want it to be:
{:file "/path/to/enzyme.bundled.js"
:provides ["cljsjs.enzyme"]
:global-exports '{cljsjs.enzyme enzyme}}
so that's my initial question, can I do global-exports thing in the package itself, so whoever uses the package can just require it idiomaticallly?
I would ask @juhoteperi how to accomplish that
he implemented most of the global-exports
functionality in the compiler
you know what, I think I have found a few cljsjs packages that include global export thingy
thanks @anmonteiro!
On the clojurescript github it says that [org.clojure/clojurescript "1.9.946"]
is the latest version, but it can't seem to find it in maven central. Is this just me or?
@madstap there was a build failure https://build.clojure.org/job/clojurescript-release/205/console
I think David is looking into it
Hi everybody. A question regarding :foreign-libs
. I am trying to add this library to my project: http://d3-legend.susielu.com/
I added this in my project.clj
:
:foreign-libs [{:file "foreign-libs/d3-legend.js"
:file-min "foreign-libs/d3-legend.min.js"
:provides ["d3-svg-legend"]}]
From Figwheel REPL, this is what I get:
dev:cljs.user=> (require '[d3-svg-legend])
nil
dev:cljs.user=> (js/d3.legendColor)
#object[TypeError TypeError: d3.legendColor is not a function]
nil
dev:cljs.user=> (-> js/d3.legendColor (.useClass true))
#object[TypeError TypeError: Cannot read property 'useClass' of undefined]
nil
Any tips?I have also tried using the file URLs in :file
:
:foreign-libs [{:file ""
:file-min ""
:provides ["d3-svg-legend"]}]
dev:cljs.user=> (require '[d3-svg-legend])
nil
dev:cljs.user=> js/d3.legendColor
nil
dev:cljs.user=> (js/d3.legendColor)
#object[TypeError TypeError: d3.legendColor is not a function]
nil
Is there a max size after which a map (in an atom) will no longer allow assoc?
@danielstockton Nope, unless your run out of memory
@rauh that's what I would have thought. Will it just fail silently in that case or i'll notice the performance of the browser tab seriously degrade?
I keep associng and subsequent get tells me it's nil. Haven't ruled out i'm not doing something stupid yet.
@danielstockton Your browser tab will likely just chrash
Yeah.. hmm
Hi, does anyone know the reason that cljs publishes its own packaged version of Google closure, rather than just depending on the one in maven? What's the difference?
@dnolen oh right so the closure library is not in maven, only the compiler is, and that's why it's packaged so that lein can get to it?
I have a build question. Addy Osmani from google released this helpful guide on image optimization https://images.guide/. For my project I would like to integrate some of the tools mentioned into my production build pipeline. What would be a recommended way to do this?
Hi ! Is there a simple way to use a local editor with a remote figwheel+nrepl? I can connect to repl, but hot reloading doesn't work (since files are changing on a local machine).
You could try using this to sync the local and remote file systems https://github.com/axkibe/lsyncd
tramp is an option too, yes, but I think If there is a way to work like I usually deal with Clojure - run remote repl, connect to it and make changes locally
[elided]clojurescript/1.9.946/clojurescript-1.9.946.jar!/cljs/core.cljs [line 988, col 14] No reader function for tag Inf.
Got this on the new 1.9.946, tried a google search, seems like there’s no reference to this.
On boot 2.7.2 and clojure 1.9.0-beta1. I will work on getting a minimal repro, but I’m jumping the gun hoping that maybe the source of the problem will be readily apparent to someone before I get that repro out.
@levitanong It is worth checking whether you have explicitly set your tools.reader dep to something lower than what ClojureScript 1.9.946 wants (tools.reader 1.1.0)
@mfikes looks like that was it! Thanks so much!!
@darwin hey, did you bring up that quoting thing yesterday because you actually tried to use eval-fn?
@bhauman did you see the commit message in the dirac repo? specifying (fn [] :something)
in config data would not bubble into cljs properly, that fn would get converted to clojure fn before it gets passed into cljs as data
arbitrary code is really tough, a var or symbol ensures that the var or symbol is compiled in an environment that can handle it, also I cheat and turn the var or symbol into a js call so that I don't have to require the namespaces of each hook which is impossible to do in a preload library
but before I made that quoting change it was wrong, because the code wasn't emitted as-was in the config
@darwin you are talking about the fn? I made a mistake and didn't handle eval-fn correctly
I don't understand, I don't remember the details of your :eval-fn
, my point was that having config as data, containing something like {:some-key (fn [] :something)}
would not be emitted into cljs as-is (with a macro which simply returns this data)
the figwheel-options config only has the function hooks that could possibly cause a problem here and they have to be symbols/strings
since I handle them as a special case I am "eliminating" the possibility of not passing data across from the macro
but I get your point, its just a bit tough to fix because I'm generating these wrapper functions that detect the existence of the function on the client side
ok, fine, I just wanted you to think about that, because that was unexpected behaviour for me, I still don't understand why it behaves like that
but when I think about it more, that data structure is in fact a clojure data structure, not cljs data structure, so not everything can be represented in cljs
if you want me to explain it completely I will, just not sure that you want need that
but it comes down to the fact that I'm managing the fact that users are passing in vars that may or may not exist when the code is loading
I understand your problem with requires, but that is completely unrelated issue to what I raised originally
I love Lambda Island tutorials. I recently tried to replicate getting test.cljs working, from Episode 33… Did git clone
, and then lein cljsbuild once test
, and got this error.
Anyone have any ideas on how to get this running? Thank you!!!
Relevant error line is:
Caused by: clojure.lang.ExceptionInfo: No such namespace: doo.runner, could not locate doo/runner.cljs, doo/runner.cljc, or Closure namespace "doo.runner" in file /Users/genekim/src.local/tmp/ep33testcljs/test/testcljs/test_runner.cljs {:tag :cljs/analysis-error}
Full console error log following in snippet…I assume the project.clj references the doo
plugin?
Yes? https://github.com/lambdaisland/ep33testcljs/blob/master/project.clj @noisesmith
:plugins [[lein-figwheel "0.5.11"]
[lein-cljsbuild "1.1.6"]
[lein-doo "0.1.7"]]
the other suggestion I can make is see if you have any cached / stale compiled artifacts from other builds that make the test task fail - I don’t know doo well enough to help beyond that though
@noisesmith Thanks for the suggestion — I did the git clone
into a totally new directory. Do you mean doing something global, like deleting the ~/.m2
directory or something like that?
oh no, removing m2 should never be needed
the only time removing m2 would help is if some project(s) deployed a new artifact with the same version number as a previous one, which is explicitly the wrong thing
occasionally an alpha lib with a lazy or incompetent maintainer does it, but nothing you would actually want to use on purpose
so if removing m2 fixed the problem, the real solution is not using the lib that required you to do that
as in, would a JSON obj passed into (clj->js (js->clj ...))
always be of the same form?
@lilactown not quite, I wouldn’t count on it
open an issue. seems like it would be easy to fix. you could do a dynamic var in utils/parse-json, you could make that a config option passed in with a default, all kinds of ways. take a stab at it and then find out which he prefers?
there's currently an open issue from about a year ago: https://github.com/r0man/cljs-http/issues/103
in clojure i can do (char (+ (int \a) 4)) -> \e
is there a good way to get a character at an offset from a?
#(char (+ (int %) %2))
?
unfortunately, it seems that (char "a")
is "a" and (char (+ (int \a) 4)
is "^D" which i think is system bell or something silly
user=> (char (+ (int \a) 4))
\e
and i can use an offset or 97, just wondering if i could do it in terms of "a"
rather than magic-number
oh, so sorry
yeah, that was going to be my follow up
(ins)dev:cljs.user=> (defn char+ [c n] (char (+ (.charCodeAt c 0) n)))
#'cljs.user/char+
(ins)dev:cljs.user=> (char+ "a" 4)
"e"
TIL you can leave the index off and it defaults to 0 (probably not recommended for readability though)
thanks to @anmonteiro for helping with this