Fork me on GitHub
#clojurescript
<
2015-06-18
>
arohner01:06:39

is it possible to round trip a keyword through the DOM?

arohner01:06:19

I have an HTML form, with a dropdown <select>. The options are CLJS keywords, and then I’ll send the selected keyword to the server, via transit

arohner01:06:34

If I om/get-node, the value comes back as a string

arohner01:06:52

which would be fine, but the keywords are namespaced, so I can’t just (keyword “foo/bar”)

teslanick01:06:26

You can't do (apply keyword (.split select-value "/"))?

arohner01:06:46

I can, it was more just understanding

teslanick01:06:38

Anything you present as an HTML attribute to the DOM is going to be stringified.

teslanick01:06:12

You can attach object-value properties to DOM objects, but the native parts of the DOM will ignore those properties.

teslanick01:06:44

One reason being -- select fields were originally meant to submit stringy data back via a form.

borkdude12:06:52

I've built this site in ClojureScript + Clojure: https://vimeo.com/130967281

hmadelaine14:06:18

@borkdude: I did not understand everything 😉 but you did a great job !

zoldar14:06:54

regarding re-com - is allowing only goog.date.UtcDateTime as input for datepicker's 'model' intentional? or was goog.date.DateTime overlooked?

gonzih14:06:51

@borkdude: good job! did you also implement some fancy server side rendering? simple_smile

borkdude14:06:10

@gonzih: not needed for this project, everything is behind a login

borkdude14:06:07

@gonzih: but I'm probably going with https://github.com/prerender/prerender when I do need it

gonzih14:06:06

@borkdude: I see. prerender looks like a lazy solution with big overhead simple_smile you can do that yourself just using some js engine.

roberto14:06:25

lazy is good simple_smile. We’ve rolled out our own in a project. I don’t think it was worth it. It is another thing you need to maintain.

gonzih14:06:01

@roberto I also have my own implementation of server side rendering in production, did not touch it for weeks, just works. So I guess it depends.

bhagany15:06:00

@maria is on a roll!

luke15:06:34

So, I've noticed that a large React/CLJS app performs much worse when the Chrome dev tools are open. My app performs acceptably when they're closed, but unusably slow when they're open. It's annoying to keep popping them open and closed, to say the least. Any ideas on what causes that, or how to disable the specific feature causing slowdown? Or is it just me?

bhagany15:06:48

I've noticed this with a large js app as well; I don't think it's just you. No idea as to the exact cause, though.

dialelo15:06:49

@luke: @bhagany @martinklepsch was experiencing this due to huge source map inlining in a JS app, splitting the source map file into a separate file solved the problem for me

dialelo15:06:10

hope that helps

dnolen15:06:51

@luke fwiw, I haven't seen that and I've seen some pretty big apps.

dnolen15:06:54

I think it may depend on what tabs you actually use (definitely true in FireFox), probably worth looking at the timeline view to see what's going on as well.

dnolen15:06:24

Also @dialelo point about giant source maps is worth double checking.

ok15:06:07

@luke I get that too, but only since a few days and with the Chrome dev build

jrychter16:06:56

@luke: it's not slowing down for me, but I'm not sure if an app with ~2500 lines of ClojureScript counts as "large" (the total :advanced JavaScript is about 1MB).

markstang16:06:07

@luke: 4000+, I don’t think I have an issue 😉

martinklepsch16:06:31

Maybe I should take back what I said earlier. I experience this kind of lagginess even with small apps when opening dev tools. I think some of it might have been due to extensive logging. Also I have a somewhat slower computer and bazillions of tabs.

thheller16:06:28

@luke devtools slow things down for me as well but usually only while loading the page. :none plus sourcemaps lead to a whole bunch of files loaded on startup. So if you require a whole lot of files it sometimes takes a while.

thheller16:06:42

it used to be worse since chrome showed sourcemap requests in the network panel

dnolen17:06:23

cool to see a well known CLer hacking on some ClojureScript simple_smile

edbond17:06:44

@dnolen: nice, thanks for sharing

jhsu18:06:45

2 is not a party =P

dnolen21:06:30

just wanted to hype @bostonou ’s blog here a bit - great resource even if you’ve been doing ClojureScript a while http://clojurescriptmadeeasy.com

rauh22:06:43

@dnolen: If I require EventType instead of import it, then it still works for me. Is that just accidental? And I should not rely on it?

dnolen22:06:12

accidental, the compiler will probably warn about this in the future

rauh22:06:18

Ah ok, because if I require it the / syntax also works

dnolen22:06:23

updated that ticket to clarify.

dnolen22:06:35

/ is only for namespaces always.

rauh22:06:02

Then I'm going back to fixing my code properly simple_smile. I was really confused since I ended up using require instead of import since it stopped working... Now I understand it was because I used /

bostonou22:06:46

@rauh: your conversation is exactly why I wrote the post. :) I had code working too, but was never sure if it was correct.

danielcompton23:06:09

Can anyone share their settings for producing sourcemaps with advanced optimisations?

dnolen23:06:39

@danielcompton: you just name a file with the same parent directory as the final js

dnolen23:06:04

:output-to “build/app.js” :source-map “build/app.map.js”

mfikes23:06:04

@bostonou: Sometimes I feel like it would be nice to have a ClojureScript portion of the Wiki that acts as a specification for all of this stuff. So far specifying the delta relative to Clojure seems more succinct, though.

danielcompton23:06:51

@dnolen: is this the correct URL in the generated JS for this config?

{:output-to "release/todo_reframe_rethink.js"
     :output-dir "release/artifacts"
     :optimizations :advanced
     :verbose true
     :source-map-path "js/"
     :source-map "release/todo_reframe_rethink.js.map"})
//# sourceMappingURL=todo_reframe_rethink.js.map

bostonou23:06:17

@mfikes: yeah i think we need a specification. the official cljs site can't come soon enough simple_smile

dnolen23:06:58

@danielcompton: why are you supplying :source-map-path?

bostonou23:06:14

it's fun having a blog that is actually useful, but an official source that can be kept up by the community is better. especially for specification type stuff

mfikes23:06:16

@danielcompton: Sorry… read that same keyword David just asked about….

danielcompton23:06:17

I thought I needed that to resolve the relative URL on the server

dnolen23:06:45

@danielcompton: you only need that if you want to do something unusual

dnolen23:06:01

sourceMappingURL is always relative

dnolen23:06:14

to the JS file itself

dnolen23:06:22

@bostonou: not sure if anything official will happen around that any time soon. The wiki will have to suffice for the foreseeable future.

dnolen23:06:36

to be honest it’s just more scaleable too

dnolen23:06:46

updating http://clojure.org is a pain in the butt

bostonou23:06:09

@dnolen yeah, i understand. given that i haven't done anything towards the official site, certainly not throwing stones simple_smile

mfikes23:06:32

@bostonou: I like a normative spec and non-normative blog posts with exposition.

dnolen23:06:13

even so I also think @shaunlebron’s et al project is probably a better direction, they have more good ideas than anything we would provide even if we did something.

dnolen23:06:45

I suspect if we ever put anything out there it would just be a pretty landing page w/ a few tutorials and lots of links elsewhere.

bostonou23:06:26

i think we're on the same page @dnolen. i was referring to @shaunlebron 's stuff when i said "official"

dnolen23:06:11

oh, k cool simple_smile

mfikes23:06:54

@dnolen: keep sharing your insights into the workings and rationale and we'll make sure it gets documented.

grounded_sage23:06:50

What does everyone think of web assembly?

dnolen23:06:26

@grounded_sage: years before it matters for ClojureScript simple_smile

dnolen23:06:33

but it could be cool one day

grounded_sage23:06:21

@dnolen: will be years before I consider myself a really good programmer. So that is why I ask :) the fact that the dominate browser vendors actually agree on something is a huge leap lol

dnolen23:06:04

It is, surprising and exciting. We'll see if the vendors can deliver on the promise.