Fork me on GitHub
#clojurescript
<
2018-05-17
>
ecolui01:05:38

Quick question. Suppose I have a JavaScript object with a deep chain of functions, so that I have to do something like obj.fn1().fn2().fn3(“hiworld”). In clojurescript, I’m trying (.. obj fn1 fn2 (fn3 “hiworld)), but not getting the expected results. Is the .. macro supposed to work with clojurescript? (ps - i know the alternative, was just curious to see if .. macro should work)

richiardiandrea01:05:07

@ecolui that looks ok to me at first glance

ecolui01:05:58

cool, thank. I appreciate it. I’ll keep on tinkering. was just curious

richiardiandrea01:05:56

I tried in http://ClojureScript.io and:

cljs.user=> (macroexpand '(.. obj fn1 fn2 (fn3 "hello")))
(. (. (. obj fn1) fn2) (fn3 "hello"))

mfikes02:05:19

(.. obj fn1 fn2 (fn3 "hiworld")) compiles to obj.fn1().fn2().fn3("hiworld")

ecolui02:05:21

nice! thanks a lot fellas!

ecolui02:05:14

Thx for that http://ClojureScript.io site — real cool

👍 8
jco08:05:12

Does anyone know a library for controlling the mouse and keyboard? To simulate key presses and clicks?

orestis10:05:04

@jco at the OS level or in the browser?

jco10:05:30

Rather the OS level, so maybe a bit OT.

orestis10:05:48

Oh that’s hard — on macOS you can work with the Accessibility API, but your app needs to have an explicit permission set by the user for that to work.

4
phronmophobic19:05:49

I guess that’s not clojurescript

👍 4
jco19:05:27

Thanks, I'll check that out.

athomasoriginal20:05:39

@jco What is the use case? For tests?

jco21:05:23

Faking user input. The touch events need to be indistinguishable from real human touches (on mobile device). Cannot go into details, but it's nothing nefarious.

wiseman23:05:09

i haven’t done clojurescript in a while, so i feel like i’m having to relearn some basics… for a project i’m playing with now, i expected the output to be a single .js file, but i’m seeing main.js, and a main.out directory that has lots of subdirectories and other .js files (`goog/array/array.js` as one example). this is with :optimizations :advanced; is there something else i need to do to get a single output file? or is that not a thing i should expect?

richiardiandrea23:05:15

@wiseman it is a bit confusing but the main.js should contain the modules, still main.out is produced as part of the compilation phase if I remember correctly

richiardiandrea23:05:27

you can check the content (or the size)