Fork me on GitHub

I started a new project and moved over the relevant parts of the code and it seems to have fixed my issue. Thanks for pointing me the right direction @dnolen

navigator.getUserMedia = function () {};
navigator.mediaDevices.getUserMedia = function () {};
works for the simple case of what I am trying to do


I am not sure why but in the other project the global navigator object seemed to be getting stomped over


and so the app.js wouldn't run


can we lazy load js code compiled by ClojureScript as we change the router in a browser?


whats the current idiomatic js interop story to iterate (probably via doseq) over goog.dom.getElementsByClass('mdl-item') and apply window.componentHandler.upgradeElement(item) to each.. ?


iirc doing something like (js/goog.dom.getElementsByClass "blah") is frowned upon?


In the frontend part of our reagent application, we have had a habit of accumulating values into a map which is then passed on from component to component. Some of the values are only relevant for logical purposes, and a subset are relevant for passing on to the final "leaf" component, such as an `[:input]` or `[:span]` or whatever. Since we bumped our reagent version, and transitively our React version, React has been outputting warnings about for example: Warning: Unknown prop `iconDisabled` on &lt;span&gt; tag. Remove this prop from the element. For details, see <> (edited) This is because we pass our saturated map directly to the leaf component. Now, I'm trying to figure out which would be the better solution. Destructuring the saturated map for only the values that we are interested in seems like the most sane solution, but it leads to having to add more stuff to the destructuring as we go along, and it seems silly to do all this only to recreate the part of of the map that we are interested in before passing it to the component. It seems like a lot of boilerplate. And having to add to that boilerplate along the way seems silly, too. So I thought, since the "legal" values for a particular element type are already known, perhaps someone has created a vetting function? Something like `(sanitize-for :span saturated-map)`


I’m curious, cljs.spec/or will output a vector containing the tag of the match, e.g. (s/conform (s/or :nil nil? :fn fn?) nil) => [:nil nil] Also, specs can be written to be recursive. The result is that I can recursively validate a map AND get a modified structure in which each value (almost) is a vector containing a tag and the value itself. I.e. I can a) validate the structure of my input b) gain a structure which makes it easy to conditionally process each value (e.g. decide which fn to apply to the value based on the tag) How do others feel about using conform to do this ?


@pseud I'm doing this with some success at present


@bahulneel good to know I’m not alone 😉


@pseud I do believe this is one of the specific intended ways to use spec.


what's the popular libraries for client-side persistent storage?


maybe some indexdb wrappers?


You mean like datascript?


maybe, I'm not sure if it saves data on disc


@pseud @bahulneel: I believe Stuart Halloway mentions this in his StrangeLoop talk:;t=33m58s


@yury.solovyov: Probably not, the README writes this >>> No facilities to persist, transfer over the wire or sync DB with the server


@reefersleep @pseud I think that's where I got the idea from, it's saved me unimaginable amounts of time and effort already.


I’ve only used localStorage with my electron apps, so I’m not sure what the best approach is. The first thing that springs to mind is sqlite


@reefersleep @bahulneel : super - I was going to do it unless some extremely insightful point in opposition to it was raised, but it seems not 🙂


@bahulneel sounds interesting, bookmarked the talk 🙂


Hello everyone. Does anyone have advice for me, please? I need to build a proof-of-concept android app, that will talk to a clojure-based server-side component. I'm hoping that there exists a good android story for clojurescript and that someone here will be kind enough to point me to the resources or advice that will help me avoid pitfalls and time-wasting (yak-shaving).


pieterbreed: don’t know about clojurescript in particular, but phonegap / cordova are JavaScript frameworks targeting & abstracting away the host platform. That way I believe you’ll target even more than just Android phones. From that point… well, clojurescript compiles to JavaScript so it’s essentially a question of interop’ing with the phonegap/cordova frameworks. Maybe someone’s written some nice wrapper libraries already, if not, well then I guess you have your work cut out for you 🙂


thank you @pseud, I'll check that out


What about react native, does that work for Android?


It’s getting closer, I think. Thought about using it in our former place of work, but Android was very much a second thought for them back then, perhaps it’s gotten great now, though


I've heard that error messages are very poor for natal/re-natal in general and that it is confusing, but then, confusing error messages are our bread and butter...


@pieterbreed in any case you might have better luck with the experts in #cljsrn 🙂


I posted a message there too, tx 🙂


@nowprovision there’s nothing wrong with using Google Closure like that to do this


however you don’t want to do stuff like js/goog.dom…, there’s no need - (gdom/…) for example if you aliased goog.dom to gdom in your ns form


@dimovich late to the party, but things like exist to help with this


@jiyinyiyong yes that’s what Closure Modules are for - code splitting so you can separate code between pages as well as for lazy loading.


the new ClojureScript site could really use a guide on modules + lazy loading (hint, hint)

dominicm14:09:08 Is using goog.module on page change the correct way to lazy load modules? Might help whoever writes that guide.

Alex Miller (Clojure team)14:09:25

I think Maria started working on moving some of her stuff already


Interesting article about JS backdoors, I assume it can also apply to Google Closure and advanced mode compilation - I'm not particularly concerned or well informed though, but it may be relevant to someone's interests or needs. I figure this is probably another good reason to prefer the Closure compiler to other minification options, though.


@shaun-mahood that is a cool article


@dnolen The Next Five Years of ClojureScript talk was really enjoyable. Your viewpoint of web development in 2011 was cool to hear, that is around when I started and it has been pretty insane all the change in the space. I am grateful to all of the devs that have contributed to making ClojureScript as good as it is now.


Glad you enjoyed it! The ClojureScript community rocks :)


How do I bind the resolved return value (in this case a json object) of a Javascript promise in a let block? all I get is a #object[Promise [object Promise]]


I mean why does (.then (fn-that-returns-a-js-promise) #(print (.-prop %))) print the value of .prop to the repl while (let [prop (.then (fn-that-returns-a-js-promise) #(.-prop %))] prop) prints #object[Promise [object Promise]]?

Yehonathan Sharvit17:09:34

I need help with cljs-http: My response is in transit json and I need to convert it to edn. cljs-http automatically converts the json into a cljs object.

Yehonathan Sharvit17:09:50

So for the moment, I am doing:

(-> json
      (transit-decode :json nil))
But I'm sure there is a better way.


@viebel is it using response headers to automatically convert?


I know that reverse debugging has been demonstrated in Clojure but has it been developed into a sort of more polished form a la elm-reactor ( ? Is this a question that's more appropriate for #om or #reagent ?


@viebel headers are arbitrary so i'd try making up your own and see if it gets through


@viebel i'm assuming you can't just send edn from the server?

Yehonathan Sharvit18:09:33

Yes! It’s the cache data from clojurescript and it is stored in transit-json

Yehonathan Sharvit18:09:17

@christianromney - when I wrote “Yes!” I meant that your assumption is right => I can’t send edn


ok i'm having trouble then picturing exactly where you want to convert to edn in that pipeline. but might this work for you? (pr-str the-cljs-obj)

Yehonathan Sharvit18:09:17

@christianromney the data is stored in transit-json format and I need it in edn


right i meant since you're pulling it and it's automatically being converted by clj-http into a cljs object


just call (pr-str ) on the returned obj

Yehonathan Sharvit18:09:36

It returns mean the json as a string and then I need to decode it with transit

Yehonathan Sharvit18:09:41

This is what I’m doing


are you married to cljs-http?


cljs-ajax does all the conversion for you

Yehonathan Sharvit18:09:04

I’m looking for a way to avoid deserializing twice

Yehonathan Sharvit18:09:16

Not married to cljs-http


i don't see how you'll get around the double conversion


since the server is sending transit json


which compresses

Yehonathan Sharvit18:09:12

I need to find a way to tell cljs-http not to parse the json

Yehonathan Sharvit18:09:18

and to leave it as a string


you can do a lower-level call, but that json will be garbage if you try to just turn it into edn

Yehonathan Sharvit18:09:23

I know, I will use transit-decode

Yehonathan Sharvit18:09:55

Do u know how to do a lower-level call in cljs-http?


ok but transit-decode will return an object, right?


transit json -> transit-decode -> cljs data structure -> pr-str -> edn


unless you want to build some special decoder that transforms transit json wire format natively into equivalent edn there's no way around it

Yehonathan Sharvit18:09:15

cljs data structure is fine for me


ok in that case, cljs-ajax will decode for you automatically. so you'll just get back cljs data from a transit response


you can also register handlers if you need to


for custom transit types