Fork me on GitHub
#clojurescript
<
2019-07-15
>
john01:07:44

For web workers to make sense, your distributed job needs to be very compute heavy, otherwise you'll waste all your time "over the wire"

john01:07:31

But there's other tricks with Offscreen Canvas and SharedArrayBuffers that allow for shared memory access in some constrained situations

john01:07:11

@neo2551 Otherwise, all data is getting serialized between workers

oskarkv02:07:32

Hm, I have a file called stats_and_items.cljs, and when I compile to stats_and_items.js I find this at the end of that file:

//# sourceMappingURL=stats_and_items.js.map
and_items.js.map
And then the browser complains that there is nothing called and_items. What is going on? Why is that and_items.js.map at the bottom of the file?

oskarkv02:07:37

Hm, I deleted my target dir and recompiled, and now the problem is gone.

oskarkv02:07:59

Hm, it's back. My guess is that cljs-devtools does it somehow.

oskarkv03:07:20

Why does it need to replace at all? 😛

oskarkv04:07:14

Maybe it's not cljs-devtools, because I have gone back to my old settings of not using them more than what figwheel-main does

oskarkv04:07:20

But now I have no idea what causes it

oskarkv05:07:45

it's really annoying 😛

zyxmn14:07:14

Hey guys , how do you check for page load in clojurescript . I want to add a class to a div after page load.

zyxmn14:07:36

Is something like this even possible or make sense ? If not , what is the right way of going about it

[:div {:class (when (on page load condition) "class-name")}] 

roman01la14:07:13

@zyxmndaleyjes

(def loaded? (r/atom false))

(.addEventListener js/document "load" #(reset! loaded? true))

(defn app []
  [:div {:class (when @loaded? "class-name")}])

roman01la14:07:27

if you are using reagent ^

chepprey15:07:43

uh oh.. wasn't there a whole debate about whether non-fn's should use "predicate naming convention", for ex. the fn odd? vs. the above example loaded? 🤓

zyxmn19:07:17

I just want to read a window event . I don't want to start a war :P

☮️ 8
hendore19:07:01

Good evening 🙂 I’m trying to add an npm dependency to a simple project. Is this the correct way to add the dep?

nenadalm19:07:53

is the file deps.edn? :npm-deps is configuration of clojurescript compiler https://clojurescript.org/reference/compiler-options which you should put together with other compiler options. For figwheel-main it's probably dev.cljs.edn (https://github.com/bhauman/figwheel-main/blob/master/docs/docs/npm.md#configure-our-clojurescript-build-to-use-libraries-in-the-bundle)

hendore12:07:13

@U60RB7X63 Hi, you are right it was in deps.edn I managed to spot this the other day and move it into my build file dev.cljs.edn however I still couldn’t see the node modules being downloaded when restarting the app 😞

hendore19:07:02

I get the following error when trying to require the namespace 😞

hendore19:07:12

I was hoping to turn some javascript code into its AST from my cljs app, I’ve done this with @babel/parser in javascript land but if anyone could recommend an alternative (If I can’t get babel parser working) then I would really appreciate it.