Fork me on GitHub
#clojurescript
<
2015-10-31
>
thosmos01:10:50

@cfleming: yes I've been needing to refresh the lein project in Cursive to update the deps (version 0.1.67 on IntelliJ CE 14). I've been mainly using the clojure.main one using a figwheel build script I got from dnolen.

cfleming01:10:31

@thosmos: Ok, thanks - yeah, with the clojure.main one you will have to. I’m planning to add a banner in the project.clj if it’s been modified since the last sync, with a link to import right away.

thosmos01:10:51

this is further complicated by the fact that on one project I'm using boot lein-generate to update the lein deps

thosmos01:10:20

oh looks like there's the option to add a sync lein projects task before running the repl

thosmos01:10:33

that works fine for now. adds some time to each repl startup, but heh, better than doing it manually. the only other little issue is that I had to close the repl window that was missing the deps and then rerun it, rather than just starting it again in the same window.

thosmos01:10:21

oops, this is what #C0744GXCJ is for

thosmos06:10:41

I just compiled a sample app with one line of code -> (js/console.log "hello console") on :optimizations :advanced and the resulting file over 100kb. Is there a switch I'm missing somewhere to shrink this further?

nowprovision07:10:48

(.' js/React createClass spec) whats the meaning of .' why would they not just do (.createClass js/React spec) ?

sveri07:10:21

Hi, not sure if this is the right channel. I am trying to parse this transit encoded string: ["^ ", ":name", "treename", ":loaded", true, "~:id", "tree-id"] in javascript with transit.js (transit.reader("json").read(s))) but keep getting this error: Uncaught SyntaxError: Unexpected token ^. Any ideas what is wrong here?

thheller08:10:07

@thosmos if you are playing with modules I encourage you to try shadow-build, it has various module related features that cljs is still missing. (eg. :none works as well, so no HTML changes required to switch between :none->`:advanced`)

sveri08:10:35

Ok, I see, the problem is that transit.reader reads a json string, but I have a javascript array

sveri08:10:09

Now, the question is, how do I make a string out of that array

thosmos08:10:41

@thheller: thanks for the ref. I'm aware of it but have yet to try it. I'll take a look at it. I'm interested in the use case of a small prerendered landing page that then downloads the rest of the app and state.

thheller08:10:22

@thosmos: yeah I have been doing that for 2+ years simple_smile works well

thosmos08:10:53

are there any good example apps on github that you're aware of?

thheller08:10:12

doubt any open source projects need that stuff

thheller08:10:47

it usually is an optimization for production so not many people talk about it (me included)

thheller08:10:06

the gains also usually really depend on the type of the app

thheller08:10:21

since cljs.core is usually a big chunk of the .js

thheller08:10:28

and it is always in the first module being loaded

thosmos08:10:09

yeah I'm discovering that. my one liner hello world was over 100k. at this point it will just be a prerendered page that will load the whole js and state to start with. that's not really a use case for modules so much as server prerendering and init from js.

thheller08:10:10

but still .. even it is only a 60/40 split .. less data to download on the landing page

thheller08:10:07

yeah you really can't do anything useful without cljs.core ... so we are usually looking at at least 30kb gzip'd

thosmos08:10:10

but it's good to know what the options are

thosmos08:10:42

and that can't be google closure dead code eliminated?

thheller08:10:08

I did some experiments and sometimes using <script async ...> yielded better results than shaving 20kb out of a 120kb download

thosmos08:10:11

i guess a lot of that is deeply interdependant

thheller08:10:41

haven't checked why a one liner isn't shorter, it should be

thosmos08:10:08

especially when that one liner is (js/console.log "hello console")

thheller08:10:14

but like I said ... you can't do anything useful without cljs.core .. so usually it won't be removed anyways

thheller08:10:00

stuff is usually kept alive due to cljs.core using a hash-map or any other datastructure itself

thheller08:10:49

but whatever the case .. if you gzip the 100kb "minimum" you end up with 22kb .. which is still less than most other .js (eg. jquery, react) even lodash is 18kb

emil0r10:10:35

how do you make an equivalent (class x) in clojurescript?

thheller10:10:24

considering that javascript has no "classes" that is a weird question

thheller10:10:30

what are you trying to do?

ul11:10:23

any core.cache analog for cljs on the table? my google-fu failed

bilus12:10:54

haven't used myself though

emil0r12:10:42

i want to upgrade a clojure library i have to clojurescript as well. one of the function calls in the library is a multimethod which dispatches on (class x)

emil0r12:10:51

and yes, js doesn't have classes, but it still has strings and sequences etc are still implemented by protocol

emil0r12:10:55

hence my question 😮

emil0r12:10:06

tried that. didn't work either 😞

bilus12:10:41

but this will still be pretty limited imo

emil0r12:10:21

but that's in js. i want it in cljs simple_smile

emil0r12:10:28

or am i missing something obvious

bilus12:10:29

can you show the code you're trying to port?

emil0r12:10:39

the crumb function

thheller12:10:13

@emil0r: what exactly doesn't work? you should be able to use class/type in that context

emil0r12:10:28

it works perfectly fine in clojure

emil0r12:10:00

but it doesn't work in clojurescript with: (class to-crumb)

thheller12:10:23

what doesn't work

thheller12:10:30

what is the error you get?

bilus12:10:42

@emil0r (= js/String (type "eeee"))

bilus12:10:50

you can dispatch on that

bilus12:10:02

cljs.core/PersistentVector

emil0r12:10:11

thank you simple_smile. exactly what i was looking for

emil0r12:10:14

big thank you

hugobessaa12:10:57

hi fellow clojurians. anyone got lucky requiring npm modules on the browser?

hugobessaa12:10:21

want to interop with a npm module, but can’t find my way to to that on the browser

hugobessaa12:10:16

never mind, just found it at cljsjs

coldnew14:10:17

Finally I did it! The first CHIP-8 emulator in clojurescript. http://coldnew.github.io/chip8.cljs/