Fork me on GitHub
#clojurescript
<
2017-06-08
>
qqq00:06:43

@darwin: it works now, I'm an idiot, it's js/amazon, not js/document.amazon ... which is why it was notworking

qqq00:06:51

i.e. it ends up being (gcall "amazon.Login...." "foobar")

samcf00:06:58

There's a defonce but is there something like do-once intended for side effects? More broadly... trying to manage this go-loop so only one is running for the duration of the session

samcf00:06:10

Should note, using figwheel and I'd like to maintain the re-runnable nature

melindazheng02:06:51

Calling all clojurians who are in SINGAPORE, please search #clojure-sg to join our Singapore clojure channel:grinning:😀

pradyumna05:06:29

@samcf i don't know much, but i think you can use the same defonce

pradyumna05:06:38

(defonce init-once
  (go-loop
	;; do your stuff
	))

tomaas09:06:08

I have this weird behavior, compiling my reagent project with uberjar vs develpment mode. In uberjar version of compilation, I the binding item gets lost (actually it prints some random value, not even nil). I'm really lost..

darwin09:06:11

In the light of that article I would say using doseq macro in a go block is very adventurous: https://github.com/clojure/clojurescript/blob/06c1b9b5bbb514d34fdc0193a730467e89f73bb8/src/main/clojure/cljs/core.cljc#L2357

darwin09:06:44

hmm, but according that article doseq should work, so maybe I’m wrong

darwin09:06:45

does it work when you print (first @items) ?

darwin09:06:30

does it work when you print items before the go block?

tomaas09:06:53

Hi @darwin, thanks for your help. This is driving me crazy, I had read that article, I used doseq in all those cases, but with this snippet, the production code (uberjar) totally user the binding of item variable in the second argument's function body. This is sad...:(

darwin09:06:20

maybe it is not problem in this async code snippet, maybe you simply put garbage into items somewhere else (due to advanced optimizations)

darwin09:06:59

aha, the problem is only inside that (fn [aux] ... now I see

tomaas09:06:18

just there

tomaas09:06:47

#(get-stuff (:_id item)) gets the :_id correctly

darwin09:06:39

what if you wrap it with let and rebind item to some other name?

darwin09:06:53

(let [xxx item] (fn [aux] ...)

darwin09:06:04

and use xxx instead inside the fn

tomaas09:06:10

I've tried it already, but nothing exactly the same behaviour

tomaas09:06:25

I'm totally lost here, began to have doubts about lexical scope rules

rauh09:06:30

I think the only way is to look at the JS output of pseudo advanced compilation.

darwin09:06:31

what about (partial (fn [xxx aux] …) item) ?

darwin09:06:45

what “print a map item of @item in develpment mode” in the comment means?

darwin09:06:58

what is expected to be in the item in correct case

curlyfry09:06:45

Is the cheat sheet documentation for "Get property" incorrect? It advocates the use of aget for getting object properties. http://cljs.info/cheatsheet/ https://github.com/cljs/api/issues/128

tomaas09:06:27

sorry, I meant, "prints a data structure map {:_id "123" :name "hola"}, where @items is a collection of those"

darwin09:06:54

I’m confused, what is @maps?

darwin09:06:05

didn’t you mean @items?

darwin09:06:33

anyways, have to go, good luck and let us know what the bug was

tomaas09:06:42

damn it, I meant @items, sorry again

tomaas09:06:28

I don't have any hope really..

borkdude10:06:35

In ClojureScript/Reagent, when I write [:iframe {:onLoad #(….)}] how do I get access to the iframe object itself using this-as?

borkdude10:06:07

Maybe this is an XY problem: my goal is to change the height of the iframe so there is no scrollbar

pesterhazy10:06:42

try using a callback ref to get the dom node

pesterhazy10:06:57

i.e. store the dom node in a local atom, then you can resize on onload (or whenever)

borkdude10:06:58

Hmm, interesting, never used it so far

tomaas11:06:44

@darwin, finally the problem was the :pseudo-names {:cljsbuild {:builds {:min :pseudo-names true}}}

tomaas11:06:59

the true value on it

tomaas11:06:12

With :advanced mode optimizations, determines whether readable names are emitted. This can be useful when debugging issues in the optimized JavaScript and can aid in finding missing externs. Defaults to false.

tomaas11:06:48

However, I can't see/understand how this could break that particular closure in my code snippet

pesterhazy11:06:06

maybe it works by accident if you set psuedo-name to false? (it's spelled with an s, do you have that?)

tomaas11:06:20

yes I have it with s

rauh11:06:03

@tomaas So, with pseudo names it works? But in pseudo names off it doesn't?

tomaas11:06:26

other way around, 🙂, with :pseudo-names true it doesn't work.

rauh11:06:32

That's strange, so advanced build, with pseudo names to false it works? Or just development? Can you gist the non-working part of the JS file with pseudo names true?

tomaas11:06:05

yes advanced build with false works

darwin12:06:51

I recall that once I had similar issue, but the other way around, when :advanced mode didn’t work, but with :pseudo-names true it worked. that was a pretty bad situation to debug advanced mode issue

darwin12:06:27

I can imagine pseudo names might not be perfect and it could generate names which shadow each other in nested scopes, that wouldn’t be a problem in advanced mode because there the names would be unique, and it works in debug mode, because the code is not inlined, so the scoping is different

darwin12:06:31

(just a theory)

cl0jurian12:06:49

Hello there, I want to know that by default closure compiler removes console.log(...) calls in advanced compilation mode

borkdude13:06:38

Is anyone familiar here with the iframe-resizer library? I have a question about it

joshkh14:06:23

regarding sente, what's stopping someone from mutating their :uid on the client side to impersonate another client before pushing a request to the server?

val_waeselynck15:06:20

@joshkh I believe it's set server-side

thheller16:06:49

@cl0jurian it doesn’t remote console.log by default

cl0jurian16:06:50

@thheller is there a way to? I found that you can redefine console.log = function(){ }; doing so. But I haven't tried that with closure compiler.

darwin16:06:10

@cl0jurian you can write a macro which emits console.log in dev mode and nothing in :advanced mode

cl0jurian16:06:38

is there a possibility to tell closure compiler to omit all the (.log js/console "...") lines right before the production compilation?

thheller16:06:39

you can make the closure compiler strip all console.log calls

thheller16:06:15

but that isn’t easy to configure as there is compiler option in CLJS for it

thheller16:06:45

(set! (.-stripTypePrefixes co) #{"console.log"}) where co is the ComilerOptions from closure. can’t go into detail … I gotta go. 🙂

cl0jurian16:06:34

@thheller thanks for the lead 🙂

newtocljs20:06:29

hi! I'm new to clojureScript and would appreciate some help

newtocljs20:06:36

what kind of cljs template project could I use where I then put in the dependency for three.js and the code example in core.cljs ?

newtocljs20:06:54

😮 thanks!

darwin20:06:31

@newtocljs DANGER: when you successfully finish this exercise, you should scrap your slack user and create a new one 😉

newtocljs20:06:54

after I create the a new project, what I am supposed to do ? the link to the READ me in the project doesn't work?

darwin20:06:30

here is the readme, I suppose:

newtocljs20:06:32

when I type, lein compile , lein figwheel, it seems to do something

darwin20:06:35

btw. https://github.com/jborden has multiple other repos with games based on this template, so maybe you can look at them instead of using the template

newtocljs20:06:50

this is boot

newtocljs20:06:59

I only have leinigen 😕

newtocljs20:06:23

in the examples from james Borden could you explain to me why I would need Node?

captainlexington20:06:53

@newtocljs What kind of project are you working on? How much experience with three-js do you have?

darwin20:06:06

@newtocljs I’m sorry I cannot help further, I just searched github and briefly looked at the readme.

newtocljs20:06:32

ok thanks I will look further through the search thanks!

newtocljs20:06:51

@captainlexington I have 0 experience with three-js

newtocljs20:06:04

ok now I found a project and it compiles! and in the html file it says: figwheel template, checkout your deceloper console ===> what to do now in the console??

mikebelanger20:06:52

@newtocljs look in your browser’s console at whatever address lein is serving from

mikebelanger20:06:43

wow, this was a bad time to give advice — I gotta go, sorry

newtocljs21:06:46

It worked, this metropolis "template" https://github.com/kybaeus/metropolis/tree/a030c3e04d513cc45fa6002ea5a61d6f96830b79worked, I threw away the source code and replaced with the example from three.js https://github.com/cljsjs/packages/tree/master/three

newtocljs21:06:23

and now I have a spinning cube 😮 now to learn some three.js and clojure state handling, should be fun!

chrisdavies21:06:28

Does anyone run their ClojureScript unit tests via Node? It seems like a lot of people use PhantomJS which is overkill for my task.

chrisdavies21:06:52

If so ^^^ do you have a sample project config or something like that?

noisesmith21:06:02

doo seems to make this a lot easier https://github.com/bensu/doo

chrisdavies21:06:32

Oh, man. I totally missed that doo supports Node.

bensu21:06:22

@chrisdavies check https://github.com/bensu/doo#node before trying it. Node has some problems with relative vs absolute paths

chrisdavies21:06:18

Thanks. Will do

michaelmrose22:06:24

random question: so I was watching a video whereby a guy wrote an example script with lumo that worked like the tree utility https://github.com/lambdaisland/birch/blob/ep29-end/bin/birch so out of curiosity I ran it on a very large directory with many files aside from being much much slower I noticed it also managed to use up 300MB of ram which while note much is pretty large for a tiny shell script if you had a variety of scripts running. I was wondering if something like lumo would be more useful if it was something like a daemon which started a thread to evaluate what was sent to it or if the memory usage is implicit in it being clojurescript

rgdelato22:06:14

maybe it's because of the mutual recursion in that implemenatation? ...in my limited experience, writing a quick Lumo script hasn't been noticeably slower than using an equivalent Node script (except for slightly slower startup). But others would know better than I would