Fork me on GitHub
#lein-figwheel
<
2016-03-26
>
peeja15:03:58

Is there a pathway I could use to have click events in the browser turn into Clojure code running in the Figwheel JVM? I'm working on a tool to let me open a relevant source file by clicking on a UI element in the browser, and I think running back through the FIgwheel websocket may be the way to do it.

peeja15:03:54

(My other option is probably navigating to some kind of openfile: URL scheme in the browser, which sounds more brittle to me.)

bhauman17:03:33

@peeja: maybe I could expose a multimethod for you to override??

peeja17:03:13

To handle messages on the JVM side?

peeja17:03:26

That seems reasonable. This is all pretty speculative on my part, though, so don't go do a bunch of work just to support my half-baked idea. simple_smile But if you think that's a good way to do it and a change you'd accept, I can play with implementing it if I ever get around to actually trying this thing,

bhauman17:03:48

It may already be there haven't looked

bhauman17:03:22

@peeja: if you look at figwheel-sidecar.components.figwheel-server near the top you'll see a handle-client-msg with a comment to that effect above it

peeja17:03:18

Ah, got it. Excellent.

peeja18:03:05

And then figwheel.client.socket/send! from the browser?

bhauman18:03:19

I believe so yes

peeja18:03:11

That's perfect. Thanks!