Fork me on GitHub
#clojurescript
<
2017-03-12
>
anmonteiro00:03:41

@dominicm @darwin there may well be bugs with new's code emission, as we only started allowing stuff like you're doing recently

anmonteiro00:03:08

previously the argument to new was enforced to be a symbol

timvisher05:03:52

does anyone know what form a fixture function should take in cljs.test?

timvisher05:03:29

i'm specifically trying to wrap each test in a with-redefs form

timvisher05:03:31

or are fixtures is cljs.test not like clojure.test fixtures from that perspective?

timvisher05:03:59

it looks like they may be more about mutating shared state rather than functionally wrapping the test?

timvisher05:03:29

no that's not true…

timvisher05:03:56

oh wow… it's because there's an undocumented option of not using {:before … :after …}. instead you just (use-fixtures :once foo-fixture)

qqq10:03:51

can lumo handle macros? if so, how ?

lmergen10:03:37

what are common ways for handling configuration and clojurescript ? i was only able to find surprisingly little about this topic what i’m talking about is some way to define some configuration variables at compile-time, so when the clojurescript code is generated. this will allow me to, say, differentiate between dev and production builds.

lmergen10:03:05

i read someone on reddit using macros to enforce this behaviour

lmergen10:03:48

or does https://github.com/adzerk-oss/env properly address my use case ?

thheller10:03:26

@lmergen you are looking for :closure-defines and goog-define

lmergen10:03:07

that indeed looks like it

thheller10:03:43

yep thats the one

lmergen10:03:56

yeah, this is perfect

rauh10:03:05

Macros are nice if you need to share some config between server side and client side. But the goog-define is often enough

thheller10:03:50

goog-define has the bonus effect that it is fully compatible with closure :advanced dead code removal

lmergen11:03:20

ok, sweet, this works like a charm!

darwin12:03:21

@lmergen I personally try to stay away from goog-defines and use :external-config with macros instead, had a bad experience with goog-defines preventing proper DCE in :advanced compilation without careful type hints[1] and got burned by a change in ClojureScript compiler behaviour once[2] [1] https://github.com/binaryage/cljs-devtools/releases/tag/v0.5.3 [2] https://github.com/binaryage/cljs-devtools/commit/4e368408986bf739b56aad64e064b854fd7989d2

lmergen12:03:54

@darwin thanks, that looks good as well! i’ll keep it in mind for later, though, since my use case is pretty simple (i’m using cljs only for end-to-end tests for now)

kauko12:03:58

I need to initialise an app with a channel that "doesn't do anything". My first reaction was (chan (dropping-buffer 0)), but that doesn't work because there's an assertion deep in the library that disallows buffers of size 0

timo14:03:41

has anyone a good recommendation on learning how to embed a js-library in my clojurescript webapp?

timo14:03:46

hi by the way

curlyfry14:03:47

@timok I'd start by checking if the library is included in http://cljsjs.github.io/

curlyfry14:03:33

(After I have checked that the functionality I'm looking for is not already in the Google closure library)

credmp18:03:15

anyone ran into TypeError: undefined is not an object (evaluating ‘ReactInternals.ReactComponentTreeHook’)` when upgrading to reagent 0.6.1?

superstructor20:03:40

@credmp nope works for me with 1.9.495, what CLJS version are you using ?

mikebelanger21:03:05

@sineer you could always use javascript-based libraries, like three.js. Depends on how many features you need right away

mikebelanger21:03:34

@sineer check out http://cljsjs.github.io for externs to those libraries, including three.js.

grav22:03:50

@timok We have some libraries that are included just by the means of a <script> tag in the index.html. The good thing is that it works, just by using js interop. Ie. js/SomeLibrary.foo() The bad parts on the top of my head are 1) we cannot use advanced compilation (which isn’t about performance but more about size afaik). 2) our unit tests running through phantomjs do not have access to the library, so if they require any namespaces that use the library, they’ll fail.

grav22:03:26

In a cljs-repl (eg figwheel’s), is it possible to override how certain types are output? Eg displaying a function as just (fn […]) ?

darwin22:03:37

@grav you can specify your own :print function when configuring this repl call: https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/repl.cljc#L953

dvingo23:03:51

any ideas on how to get clj->js to give me a JS key that is a string that starts with a colon? like : (clj->js {":hover" {:background "red"}}) i'd want this JS output: {":hover": {"background": "red"}}

dvingo23:03:53

nvm, my problem is elsewhere - wrapping it in a string works

richiardiandrea23:03:16

@danvingo oh ok, but you can by doing:

(defn keyword->str [k]
  (str (if-let [n (namespace k)] (str n "/")) (name k)))

(extend-type Keyword
  IEncodeJS
  (-clj->js [x] (keyword->str x))
  (-key->js [x] (keyword->str x)))

richiardiandrea23:03:36

with of course you custom encoding/decoding

dvingo23:03:50

ooh, very nice, thanks!

richiardiandrea23:03:18

thanks D.Nolen for thinking ahead 😄

richiardiandrea23:03:44

(or the contributor it was someone else's work)

dvingo23:03:02

pondering if this can be (ab)used to get macro like behavior for types that expand to JS forms

richiardiandrea23:03:41

oh I bet that have been abused a lot ... 😄