Fork me on GitHub
#clojurescript
<
2017-01-18
>
deas09:01:46

What would one do to determine the weight (advanced optimized) added by a first level dependency?

rauh09:01:41

@deas You'd have to try it out, with/w/o the dependency (and using it to avoid DCE). Or you can ask here if you tell us the library and you might get a ballpark number

deas09:01:31

@rauh Measure w/o the deps: Was hoping for a simpler solution. Looks like I'll have to swallow the pill. Thanks.

len09:01:59

We have an app that is starting to manage a lot of data on the client side - multiple large lists - are there any pointers or advice for managing the local store - cache etc - or a different way to think about ?

rauh09:01:51

@len Can't recommend Datascript enough. It's perfect for a lot of different entities.

len09:01:38

Thanks @rauh - so just fetch and add to datascript ? Any way to manage size of the app-db ?

rauh09:01:56

Yeah depending on what your data looks like, it'll be easy to add it to datascript. The size of the DB is pretty small since datascript doesn't duplicate anything. But if you need to get rid of old stuff then you'll need to purge it manually

miikka10:01:44

I guess there's not yet lein-cljsbuild support for self-hosted ClojureScript, or something like that?

claudiu10:01:47

@rauh Is working & debuging with datascript nice ? A bit used to atom state, that I can print, and inspect easily.

rauh10:01:58

@claudiu With a few helper functions, yes. I recommend (es-by-a :post/id) -> "gets all post entities" or (e-by-av :post/id current-post-id) etc.

claudiu11:01:16

@rauh cool, will give datascript a try and see how it goes. Definitely have a use-case for it in my next project, not sure yet if it's a good fit for the entire app state.

jdkealy15:01:49

if i had a loop of images i was downloading and a callback when each one had downloaded, can i use core.async to prevent the loop from proceeding to next item in list using core.async until the callback has been called ?

mavbozo16:01:12

no, your fn returns the result of the go block immediately. and the go blocks run on different "thread"

jdkealy16:01:37

how would you tidy this up ?

mavbozo16:01:41

well the browser capable of parallel image download. do you want to download the images one-by-one one after the other finished?

jdkealy16:01:47

i do want to go one by one... downloading all at once is freezing my browser

jdkealy16:01:38

i want (<! c) to wait until the callback has put something on the channel

mavbozo16:01:59

you put all of that processing inside the go-loop block but instead of waiting for timeout, you wait for the callback result

jdkealy16:01:17

hmm not sure i'm following

jdkealy16:01:02

isn't that what i'm doing in (<! c ) ?

jdkealy16:01:31

so i open a channel, make a go block, call a function with a callback, put a value on the channel in the callback and below the part where the function recurs i take from the channel, hypothetically causing the loop to block

jdkealy16:01:48

the above function creates the error ">! used not in (go ...) block"

jdkealy16:01:10

and (<! c) doesn't block also

pbaille16:01:14

what is the simplest way to perform a deepcopy on a js object in clojurescript?

pbaille16:01:41

more concretely I would like to clone a canvas’s 2d context

mavbozo17:01:38

@jdkealy back to your original snippet, the doall map immediately returns a sequence of channels which those go block returns. then image downloads are done by browser in those separate go blocks. no coordination between those go blocks, so the browser attempt to run those download in parallel.

jdkealy17:01:21

@mavbozo what would you use instead of doall, the loop doesn't execute without it

jdkealy17:01:30

i just tried with doseq, that works ok, still no luck on the blocking though

mavbozo18:01:04

@jdkealy i would use a go-loop that reads img to download from a input channel then download the img. something like this code sketch

mavbozo18:01:31

each download will block the next one because go-loop block will wait for the value of channel returned by download function

jdkealy18:01:40

wow works perfectly thanks so much!

gdeer8119:01:18

if someone is working on something like https://javascript30.com but for clojurescript, let me know

enimiste22:01:02

can we use clojurescript on mean stack ?

mruzekw22:01:57

I’ve never heard of CLJS and angular together but I suppose it can be done with interop

geoffs22:01:24

sounds like more trouble than it's worth...

mruzekw22:01:26

You can certainly use any backend you like

mruzekw22:01:52

The typical UI pairing with CLJS is ReactJS

isak23:01:39

having some issues with names getting screwed up (advanced compilation) when combining cljsjs foreign-libs and module splitting. is this a problematic thing to do theoretically?

isak23:01:41

> :modules fully supports :foreign-libs. :foreign-libs are always put into dependency order before any Google Closure compiled source.

isak23:01:00

never mind, that answers it