Fork me on GitHub
#clojurescript
<
2018-11-19
>
todo04:11:31

Besides shelling out $800 for an mac mini, is there anyway to debug cljs running on safari on ipad ?

dnolen06:11:20

@todo hrm maybe try WebKit on Linux/Windows?

todo07:11:15

@dnolen: it involves touch events; so it really has to run on an ipad (which I have)

orestis07:11:02

Are you on Windows or Linux?

orestis07:11:33

I haven’t used it yet but I’m curious to see how Browsertack might help with this kind of thing.

dnolen08:11:14

@todo well I thought remote debugging was a WebKit feature

dnolen08:11:32

if I recall that was the whole point of getting Apple's WebKit building on Windows/Linux

iobuhov08:11:22

Hi there. I'm wondering is it ok to ask newbie questions here, in slack channel, or there is a better place for such questions?

dnolen09:11:06

newbie questions are fine here, there is a #beginners channel for generic Clojure questions as those often apply to ClojureScript

iobuhov09:11:48

Oh, thanks @dnolen, I'll use beginners channel.

dnolen09:11:09

@todo hrm maybe things have drifted since I last checked - it might be running OS X really is the only reliable way now

folcon09:11:05

Is there a good example of setting up consistent testing between cljs and clj? I’m working on a library that’s based on work that’s a mixture of clj+cljs and I’d prefer to do as much as possible with code written in cljc, but setting up any kind of testing has been really frustrating. Currently a lot of it is hand testing in the repl, but that seems rather inadequate…

borkdude09:11:15

@folcon I’ve been doing this with speculative a lot. I’m not sure how much of it is similar to your use case.

folcon11:11:25

@U04V15CAJ Do you have a link?

folcon11:11:12

Found the github, just trying to understand how to use it =)…

borkdude11:11:17

I meant, I wrote a lot of tests for clj + cljs in cljc in that lib. Maybe the examples are useful to you

folcon11:11:25

Thanks, regarding examples, you mean this, or something else? https://github.com/slipset/speculative/blob/master/doc/test.md

borkdude11:11:40

No, the tests.

folcon11:11:34

Ah, thanks =)…

borkdude11:11:52

We found some inconsistencies between clj and cljs that way

folcon11:11:19

I’m going to give this a decent read, thanks =)…

cjohansen09:11:11

is it possible to create an atom in one CLJS build and call add-watch on it in another, separate CLJS build? my initial attempt seems to suggest “no”. I have api.cljs with (defn ^:export watch [atom]), and then in another file, I basically do (js/my_first_build.api.watch (atom {}))

cjohansen09:11:45

this is throwing me an error, but I’m hoping I’m just holding it wrong, and that this is somehow possible

thheller10:11:21

@christian767 no you should never load 2 different CLJS builds on the same page. they will not be compatible with each other (especially after :advanced compilation)

dnolen10:11:37

@christian767 you can't have multiple builds as @thheller said

cjohansen10:11:15

I’m curious: is this something that is inherently “impossible” to achieve, or has it just never been an issue?

thheller10:11:14

it is not impossible just completely undesirable. both versions would load their own version of cljs.core + all the supporting libs

thheller10:11:42

so just combining both builds into one (using :modules maybe) will just be a better result overall

dnolen10:11:14

@christian767 effectively impossible yes

dnolen10:11:15

as ClojureScript is loaded into the global environment

dnolen10:11:05

if we didn't do that you get a bunch of other undesirable properties - damaged REPL dev, incompatible instances, etc.

dnolen10:11:13

blah blah tradeoffs blah blah 🙂

cjohansen11:11:50

I understand 🙂

cjohansen11:11:28

I was looking into developing a chrome devtools extension in cljs, and pass data to it from a cljs-app in the browser

thheller11:11:42

you must send serialized data for that anways as the extension runs in a different context. use transit to transfer the data.

cjohansen11:11:54

yup, I figured as much

cjohansen11:11:00

thanks for the input

darwin11:11:16

btw. I found channels pretty useful in that context, I have a channel on either side and small glue code which takes from one, serializes, calls other side, which deserialializes and puts on the other channel

darwin11:11:43

then I can reuse code working with channels on both sides

darwin11:11:07

the code is not concerned if the channel is “direct” or this kinda “proxy”

cjohansen11:11:15

what kind of channels are we talking here? core.async ones?

dazld15:11:14

when a cljs function is operating on a native JS object, is there any way to type hint what that is for IDEs like cursive..?

dazld15:11:38

i’m thinking of the way you can write jsdoc annotations for IDEs that support it

dazld15:11:02

like.. canvas contexts, events..

Joseph Hance16:11:16

I'm working with the cljs-ajax library and a GET call to a back-end service that returns a document as a stream. In the header it returns the type of document, application/pdf, image/jpeg, etc. In the GET call I can get the stream using: :read protocol/-body or I can get the headers with :read protocol/-get-all-headers, but I can't figure out how to get BOTH the headers and the stream in one call.

folcon17:11:19

What’s the GET call you’re using?

folcon17:11:54

@joseph.hance? From the last time I was looking at cljs-ajax I remember that :read just called the function passed. So why not just pass a function that calls those two and perhaps returns a map or vector?

fabrao18:11:27

Hello all, how do I use js like this?

<Image
  style={{
    flex: 1,
    alignSelf: 'stretch',
    width: undefined,
    height: undefined
  }}
  source={require('../../assets/images/onboarding-how-it-works.png')}
/>
-> undefined?

folcon18:11:07

What’s that in? reagent? om? or just using hiccup?

Joseph Hance21:11:54

@folcon I switched to r0man's cljs-http library instead and that made this a lot easier. I suspect there is a way to do it with the cljs-ajax library but I couldn't figure it out.

grav21:11:19

Hey! I have implemented a simple library, consisting of one .cljs file, and a dependency on an npm package. I’m developing it with an additional ns for the “application code” with deps.edn and figwheel-main. How would I go about packaging that up into a jar? Can I avoid using additional build tools such as cljs-build, shadow-cljs or leiningen?

thheller21:11:53

@grav for the library itself you don't need to build anything but depending on how you load the npm module additional work needs to be done by the consumer of said library

thheller21:11:22

shadow-cljs is currently the only option that does this automatically. others need additional setup

thheller21:11:39

typically the "safest" option is creating a cljsjs package

cfleming21:11:06

@dazld There isn’t right now (for Cursive, at least) but I’m thinking about some options.

👍 4
grav22:11:00

@thheller Thanks, it makes sense that it’s up to the consumer to load the npm library

folcon22:11:23

@jhendrey Glad you got it working :)…

jaawerth23:11:46

@grav there some newer built-in support for that stuff, including for the two types of modules you're likely to run into from npm (CommonJS or ES modules) https://clojurescript.org/guides/javascript-modules#javascript-modules