Fork me on GitHub
#clojurescript
<
2017-06-25
>
dnolen01:06:38

@sh3rawi no, because lein cljsbuild may use slightly different default compiler options

metametadata11:06:20

@pesterhazy all I tried to say is that one shouldn't block in majority of cases. But it can be ok to block in some special cases, e.g. in test code.

pesterhazy11:06:12

@metametadata right, I understand, I'm just wondering in what circumstances blocking would even have an effect (genuinely trying to understand)

pesterhazy11:06:49

perhaps in node.js, you could readSync a file repeatedly

metametadata11:06:25

yeah, so probably mostly in apps without interactive UI

pesterhazy11:06:38

could you give an example?

metametadata11:06:42

tests 🙂

metametadata11:06:53

you jsut wait for them to finish

pesterhazy11:06:57

what kind of event could you wait for synchronously in tests?

pesterhazy11:06:26

you can't poll events in JS, right?

pesterhazy11:06:37

all you can do is register an event handler

metametadata11:06:44

if it's a webdriver test, than you can sleep for a sec and then check if the button is rendered

metametadata11:06:09

i.e. waiting for some external event to happen

pesterhazy11:06:31

maybe I'm being obtuse but i don't understand how that would work

pesterhazy11:06:43

does any javascript runtime give you a synchronous sleep?

pesterhazy11:06:31

you can of course do (dotimes [n 1000000] (js/Math.sqrt 99999)) or something like that

metametadata11:06:37

not out of the box. right

metametadata11:06:49

just a loop which checks the current time

pesterhazy11:06:56

but even then you wouldn't get access to new events - you'd have to give up the current execution context

metametadata11:06:54

in my example tests are run in a separate process from the page they testing (page is rendered in the headless browser to which tests are connected via webdriver protocol), so it's really fine to just synchronously sleep in test process

pesterhazy11:06:52

right but you're communicating with the headless browser via tcp right?

metametadata11:06:12

but thinking about it more, it's not a best idea to just make CPU busy via a sync JS sleep

pesterhazy11:06:31

you could accomplish the same thing with setTimeout, methinks

metametadata11:06:15

yes. I do it in Clojure actually: sleep for some time, then ask a browser via webdriver for the info about the rendered page ("is button shown?").

metametadata11:06:06

yes, I agree, it was a bad example after all

metametadata11:06:56

in Clojure I use "synchronous" Thread/sleep which pauses the execution, but it really doesn't make CPU busy. JS cannot have that, so setTimeout is the better choice

pesterhazy11:06:16

right, Clojure is a different beast altogether

pesterhazy11:06:53

In other news, has anyone played with https://zeit.co/now ?

pesterhazy11:06:16

It's a very fast way to deploy a quick server in the cloud

pesterhazy11:06:16

I wonder what it would take to get the same to work with clojurescript

dnolen15:06:34

@pesterhazy it’s just Node so I would expect nothing? 🙂

pesterhazy16:06:43

@dnolen, you can deploy javascript using a single command, now - it would be great to make that work with the bootstrapped compiler as well

richiardiandrea16:06:48

@pesterhazy I was reading and you can have a custom build with a custom now-build entry in your package.json

dnolen16:06:51

@pesterhazy right it could be made even easier

hmaurer17:06:52

@pesterhazy now.sh supports docker too

hmaurer17:06:31

you could just write a custom Dockerfile which compiles and runs your project

mobileink18:06:15

Hi. Got a start on an interop reference doc page. Loosely follows the Java Interop page for Clojure. Corrections, suggestions etc. welcome. Once it’s more or less correct and complete it can be transferred to the official site if that would be useful. @dnolen please let me know if something along these lines is ok. See https://github.com/miraj-project/homepage/blob/master/doc/reference/js_interop.adoc

dnolen19:06:36

@mobileink whoa 🙂

mobileink19:06:49

er, "whoa" in "cool" or as in "settle down there, buster"? simple_smile

dnolen19:06:01

“whoa” as in “awesome”

dnolen19:06:21

@mobileink I would just put together a PR

mobileink17:06:42

dnolen: ok, forked the repo and created 2 branches, one for a ref page and one for a guide. is it best to submit PRs or refer people to the fork? https://github.com/mobileink/clojurescript-site

mobileink17:06:17

should I open an Issue or Jira as well?

dnolen17:06:57

yes please

dnolen17:06:03

I mean no to JIRA

dnolen17:06:09

for site we just use GitHub

mobileink20:06:57

sorry to be a nudge, but i'm not very familiar with the PR protocol. should i sub a PR? if i do can people edit it?

dnolen01:06:39

@mobileink I don’t know if people will edit directly but they can at least provide feedback

mobileink15:06:21

just submitted a PR for the ref page. at least I think I did, not very familiar with the PR workflow.

dnolen21:06:03

sweet! Thanks will take a look 🙂

dnolen19:06:31

this way everyone can pitch in on the review

dnolen19:06:52

it’s OK even if it’s in a half done state

mobileink19:06:05

ie fork clojurescript-site etc.?

mobileink19:06:11

question about interop: the print syntax seems to use #js. e.g. if i do (js-obj ... ) what prints is a #js form. but i was expecting javascript. is there a way to see the js? in a repl, i mean.

dnolen19:06:44

we hide the generated JS since it’s not particularly useful in most cases

dnolen19:06:02

you can use :repl-verbose true to force the REPL to print the generated JS

dnolen19:06:19

but that’s a debugging feature

mobileink19:06:39

... and an excellent learning feature (for those of us who cannot entirely trust software, heh.) thanks.

alice21:06:24

using reagent.cookies/set! from reagent-utils works when I directly pass a string, but not when I pass it a string variable, this is odd

(cookies/set! :hello "my heads gonna fucking explode lol")
(cookies/set! :session token)
https://i.imgur.com/GXITQ1D.png