Fork me on GitHub
#clojurescript
<
2018-01-30
>
xiongtx02:01:27

Must the :output-dir cljs compiler option’s value be the path of :output-to? I’d like my :output-to to be resources/public/.../prod.js, but I don’t want the cljs / JS files from :output-dir in resources b/c they’d get copied to the JAR w/ lein uberjar, which they don’t need to.

xiongtx03:01:58

Is there any difference b/t putting a dep in the :provided profile vs putting :scope "provided" in the dep vector in the regular dep? Same for test.

tomaas11:01:44

Hi, i'm trying to get [re-com/single-dropdown...] work with some z-index lower than a div to its left. I want that when single-dropdown is scrolled to left of that div, it would get under the div. Having a div with a positive z-index, greater than the positive index of re-com's single-dropdown does not work (it still gets shown over the div). Setting the single-dropdown to negative z-index works, but then it becomes not clickeable.

urzds13:01:19

How would I get a unique identifier for an "object" in ClojureScript? Is there some function which gives me a "pointer" that I can then use as a unique representation of the object? I don't need to be able to map back from the identifier to the object, but just be able to check whether the objects in a list (or their order) have changed. (This is for Reagent's :key property.)

rauh13:01:11

@urzds goog/getUid

vemv13:01:04

Hiya. Wondering if it'd be advisable to code an om.core/build wrapper which does a try/catch. The effect would be similar to React 16 error boundaries

vemv13:01:19

(we stick to R15 for now)

vemv13:01:52

also, an existing library / code could be inspiring. At its core the idea seems simple, but maybe there's some gotcha?

urzds14:01:57

@burke: I assume hash is not as slow as it sounds?

rauh14:01:09

@urzds Depends on your types. What are your objects?

rauh14:01:21

Note hash will eventually fallback to goog/getUid

jikuja16:01:11

Anyone know if boot-cljs-test should print amount of tests when using node as backend? Fancy examples are showing numbers but my environment is not.

jikuja16:01:14

I have minor fears that it is not testing anything at all. Did that earlier with async code.

langmartin16:01:43

I loaded up my app under the re-natal for the first time this weekend, and some of my macros failed to expand. the same code works fine under lein + figwheel + browser. are there any known differences related to macro expansion between those environments? I'm on 1.9.946 in both cases

langmartin16:01:08

I am mostly doing macro things that used to not work in clojurescript like using plain require to include the macros

langmartin16:01:08

@jikuja you might be able to add some side-effecting lines to a test (print to console) just to make sure the tests are running, that would eliminate some possibilities. if the printer won't work, a long-running loop can at least verify the running part

urzds16:01:51

@rauh: Also, with (hash my-map), I would get the same value for different objects, if their content is the same, right? I.e. in (map hash [{:a 1} {:a 1}]) => (N N), for some number N? At least that's what testing this with planck suggests.

rauh16:01:49

The proper way to do this IMO is to give the map a unqiue ID when you create it.

fellows19:01:22

Following up on @gseyffert's question about resolving multi-specs in clojurescript -- we'd like to be able to take a multi-spec definition (as returned by (s/form), e.g., (cljs.spec.alpha/multi-spec some-ns/multi-method-name ::spec-name)), resolve its associated multimethod and call methods on that. The goal is to get all the underlying spec defs so we can call s/form on those. This can be done in regular Clojure via (methods (var-get (resolve namespaced-multimethod-symbol))). Something similar works in the cljs repl, but does not work from within compiled cljs code. Does anyone have any ideas as to how to do this correctly?

kingcode21:01:17

I am trying to write a browser extension to run on Firefox following the advice at https://developer.mozilla.org/en-US/Add-ons/WebExtensions I would like to use clojurescript, but would need to “export” the browser (FF) API for my clojurescript to compile…is this possible? Ideally I would like to have the browser API as a library JS file which I can reference to develop my UI as a standalone client app. Any ideas? Thx…

noisesmith21:01:58

if you make an externs file describing the things you use from the browser api it should work

noisesmith21:01:19

oh - that's just for compilation to work

kingcode21:01:10

@noisesmith OK thx…but how would I access the libs? They seem to be available only from within the FF environment, no?

noisesmith21:01:46

@kingcode right so for interactive development you could use figwheel connected to firefox

noisesmith21:01:50

for things like unit testing or running parts of the code in a standalone or another browser, you'd need to abstract the FF specific things and make them an optional implementation but you might not even need that if FF is your only target

noisesmith21:01:25

the cljs compiler as I recall is happy to make output that refers to things that it can't find when compiling

noisesmith21:01:37

it's just a runtime error if they are not present when you launch the actual js code

noisesmith21:01:52

the cljs compiler (the canonical one at least) is a java program, it doesn't even run js

kingcode21:01:20

Indeed FF is my only target - I am experimenting now with a bookmarking app. Oh really? I didn’t realize cljs doesn’t need to have the extern libs to compile…cool, will look into it - Thank you!

noisesmith21:01:42

it needs something called an "externs file" for advanced compilation

noisesmith21:01:58

that is a lot like a .h file for c code - it describes the things you will use at runtime that are not in your code

noisesmith21:01:14

for normal development, and regular compilation, you don't need the externs file

noisesmith21:01:06

there are three standard optimizations settings - advanced, whitespace, and none - externs files are only needed for advanced

kingcode21:01:16

@noisesmith I am happy “blind-coding” then running the compiled JS inside the browser for starters. However it would be really cool to be able to use figwheel to live-code against the API: then I would need to export the browser API to a file/module somehow…

noisesmith21:01:37

no - all you need is to run figwheel and then connect firefox to it for that to work

noisesmith21:01:54

figwheel is incompatible with advanced optimization anyway

kingcode21:01:58

really? Just like a regular webapp?

noisesmith21:01:16

right - unless firefox would refuse to load things using this api over a websocket

noisesmith21:01:23

or otherwise rejects how figwheel does things...

kingcode21:01:55

@noisesmith Are you familiar with the extension dev setup?

noisesmith21:01:03

if so, you would need to use cljs.jar or cljsbuild, and then point the browser at your js file

noisesmith21:01:14

@kingcode only minimally, sorry

kingcode21:01:33

@noisesmith Thanks again for your advice! Much appreciated, will look into your suggestions 🙂

noisesmith21:01:45

but anyway, the problem wouldn't be on the cljs side - it's happy to call js that it doesn't know about

noisesmith21:01:19

or - more accurately - happy to create code that calls js that it can't prove works, haha