Fork me on GitHub
#clojurescript
<
2016-10-06
>
bcbradley03:10:47

does anyone know of any webrtc libraries for clojurescript?

dnolen03:10:58

@olivergeorge the tradeoff has been assessed and it’s not something we’re interested in pursuing.

Oliver George09:10:23

@dnolen fair enough. Thanks.

Oliver George09:10:53

@dnolen It feels like adding a new key to the destructing macro would be safe. let [{:jobj [a b]} someobj] would be safe but no doubt there's more to that sort of decision.

darwin10:10:04

@andrewboltachev NP-complete problem is not impossible to compute, it just a kind of “hard” problem where you essentially have to try to test all possibilities

andrewboltachev10:10:29

@darwin aha, so should be just one that requires tremendous amount of memory/speed

darwin10:10:07

yep, for big inputs you need a lot of computation, not necessarily memory

Adam Munoz11:10:38

Hello, where can I find browser support for clojurescript? Or is it just the same as for closure compiled code?

Adam Munoz11:10:12

@vikeri Oh O.K. thank you 🙂 I didn't see that in the docs

borkdude13:10:16

reposted from #reagent:

(ns foo
    (:require [cljsjs.react :as react]
              [reagent.core :as reagent]))
  (reagent/adapt-react-class react/ReactCSSTransitionGroup)

borkdude13:10:41

question: should the reference to react/… work when I depend on cljsjs/react-with-addons?

anmonteiro13:10:30

@borkdude you should use js/React

anmonteiro13:10:53

aliasing foreign libs has no effect at this point

anmonteiro13:10:03

only if they’re consumed via the modules option

anmonteiro13:10:22

(and CLJSJS libs aren’t)

anmonteiro14:10:39

^ here are the relevant docs

lwhorton14:10:04

hey guys, does anyone use something like http://sentry.io or raygun with cljs? i’m curious how they got source-maps to work. in the case of sentry, you can pre-upload compiled + sourcemap files so that at runtime an error doesn’t trigger a GET /main.js.map to a huge sourcemap. the problem is, though, that sentry (and im not sure if this is a sentry problem or a misunderstanding of source maps) wants to fetch things like /main.out/foo/bar.cljs but can't

lwhorton14:10:13

does this mean that my sourcemap is pointing from /main.js -> main.js.map -> main.out/foo/bar.js -> main.out/foo/bar.cljs, and that’s why the GET is attempted? how are all these files rolled into the main output of the closure compiler?

isak14:10:40

anyone using transit to send edn to a web worker? would it work without going to a string?

isak14:10:27

looks like no

dnolen19:10:46

@isak the only way to talk to workers is via string serialization

dnolen19:10:35

@olivergeorge yeah we’re just not going to bother - that’s the answer 🙂

isak19:10:30

@dnolen : here they say "Data passed between the main page and workers is copied, not shared. Objects are serialized as they're handed to the worker, and subsequently, de-serialized on the other end. The page and worker do not share the same instance, so the end result is that a duplicate is created on each end. Most browsers implement this feature as structured cloning." , so i wonder if it is possible to do better than cljs->json-str->json-obj->cljs

dnolen19:10:27

Not that I'm aware of sorry

verma19:10:55

hmm, I think there’s a way of transferring ownership between main process and webworkers

verma19:10:22

unless something else is being discussed here

isak19:10:43

that is only for special types of objects like ArrayBuffers, isn't it? and in 2 browsers

isak19:10:10

> Google Chrome 17+ and Firefox 18+ contain an additional way to pass certain types of objects (transferable objects, that is objects implementing the Transferable interface) to or from a worker with high performance. Transferable objects are transferred from one context to another with a zero-copy operation, which results in a vast performance improvement when sending large data sets.

verma19:10:11

yeah, but may be you could serialize cljs->edn->postMessage->edn->cljs

verma19:10:47

I use super big arraybuffers in one of my projects and it seems to work in all sane browsers.

isak19:10:09

what about having a json-object reader and writer for transit, instead of a json-string reader/writer?

isak19:10:21

maybe it would be faster

verma19:10:13

I’d prefer arraybuffer reader/writer so I can turn them into opaque data and throw it across worker boundaries.

isak19:10:32

@verma : wait are you transmitting edn that way? how?

verma19:10:10

no I am not, but large amounts of binary data

verma19:10:18

sorry if my comment indicated otherwise

verma19:10:28

I was suggesting we could do something like that

isak19:10:03

ah i see. unfortunately i have to use normal clojure data structures

verma19:10:33

I thought transit could do clj->binary .. sorry I don’t know very much about it.

verma19:10:05

I mean its definitely better than having JSON in the middle there and then losing some type info/data types.

isak19:10:30

yeah, that is the problem i have now

verma19:10:43

but may be cljs->pr-str->arraybuffer->postMessage->read-string->cljs ?

verma20:10:08

like on large objects you can transfer ownership instead of having it make a copy.

isak20:10:41

yea that would work, though might be costly for the ui thread

isak20:10:17

and just normal transit would be faster

isak20:10:48

but array buffer might help

verma20:10:52

yeah, I guess there’s a tradeoff, the JSON transit emits seems to have hinting to recover the type/data info. so you could use transit to encode your clj data and then send it over but I don’t think its transferrable.

verma20:10:53

and for supposedly larger sets of data you could go the transferable route by converting things to arraybuffer.

isak20:10:53

the transit json object would be transferrable, since the stuff that is transferable is actually a superset of json

verma20:10:12

interesting, I am not aware of that

isak20:10:13

so the problem is it is not exposed

isak20:10:42

someone should tell them about persistent data structures

darwin20:10:08

@isak I had a similar problem a year ago, there was no solution, ended up using transit for serialization, even if you had shared-memory json object kinda feature, you could not pass cljs values across javascript contexts, I learned the hard way using shared js contexts between iframes. the problem is that both js contexts typically end up with different cljs code, imagine one context has older cljs version than other. But it can be more subtle than that. For example in advanced mode you end up with completely different field names.

isak21:10:49

@darwin : ah makes sense, thanks

darwin21:10:15

to be more precise, you could not pass cljs values across javascript contexts easily, you would have to be super careful, that both contexts strictly use code from the same :advanced build

darwin21:10:30

to touch that shared object

darwin21:10:50

as a side note, I happened to be sharing an object between two javascript contexts, ended up serializing them as plain js object with original serialized as string edn, but there was one pesky problem, the shared structure contained functions (callbacks), core.async channels and promises

darwin21:10:47

but the story ended happily, I wrote a generic function which serialized all “callable” stuff to callbacks and included it in plain js-obj passed across, and that worked just fine