This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-06-25
Channels
- # beginners (32)
- # boot (1)
- # cljs-dev (25)
- # cljsrn (1)
- # clojure (35)
- # clojure-dev (6)
- # clojure-nl (4)
- # clojure-russia (12)
- # clojure-spec (13)
- # clojure-switzerland (2)
- # clojurescript (63)
- # cursive (9)
- # datomic (18)
- # dirac (32)
- # graphql (6)
- # luminus (8)
- # off-topic (18)
- # pedestal (5)
- # protorepl (1)
- # re-frame (30)
- # remote-jobs (5)
- # untangled (61)
- # yada (7)
@sh3rawi no, because lein cljsbuild may use slightly different default compiler options
@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.
@metametadata right, I understand, I'm just wondering in what circumstances blocking would even have an effect (genuinely trying to understand)
perhaps in node.js, you could readSync a file repeatedly
yeah, so probably mostly in apps without interactive UI
could you give an example?
tests 🙂
you jsut wait for them to finish
what kind of event could you wait for synchronously in tests?
you can't poll events in JS, right?
all you can do is register an event handler
if it's a webdriver test, than you can sleep for a sec and then check if the button is rendered
i.e. waiting for some external event to happen
maybe I'm being obtuse but i don't understand how that would work
does any javascript runtime give you a synchronous sleep?
you can of course do (dotimes [n 1000000] (js/Math.sqrt 99999))
or something like that
not out of the box. right
just a loop which checks the current time
but even then you wouldn't get access to new events - you'd have to give up the current execution context
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
right but you're communicating with the headless browser via tcp right?
but thinking about it more, it's not a best idea to just make CPU busy via a sync JS sleep
you could accomplish the same thing with setTimeout, methinks
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?").
yes, I agree, it was a bad example after all
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
right, Clojure is a different beast altogether
In other news, has anyone played with https://zeit.co/now ?
It's a very fast way to deploy a quick server in the cloud
I wonder what it would take to get the same to work with clojurescript
@pesterhazy it’s just Node so I would expect nothing? 🙂
@dnolen, you can deploy javascript using a single command, now
- it would be great to make that work with the bootstrapped compiler as well
@pesterhazy I was reading and you can have a custom build with a custom now-build
entry in your package.json
@pesterhazy right it could be made even easier
@richiardiandrea precisely
@pesterhazy now.sh supports docker too
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
@mobileink whoa 🙂
@mobileink I would just put together a PR
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
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?
@mobileink I don’t know if people will edit directly but they can at least provide feedback
just submitted a PR for the ref page. at least I think I did, not very familiar with the PR workflow.
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.
... and an excellent learning feature (for those of us who cannot entirely trust software, heh.) thanks.
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