cljfx

zane 2022-06-18T01:55:51.564039Z

Does anyone have examples of calling Java from JavaScript in a JavaFX webview that was created by cljfx?

zane 2022-06-18T02:31:49.119499Z

Maybe not possible? https://clojurians.slack.com/archives/CGHHJNENB/p1607571654183600

zane 2022-06-18T03:35:43.791529Z

Hmm.

vlaaad 2022-06-18T06:24:41.116499Z

It's possible!

vlaaad 2022-06-18T06:39:14.836219Z

I don't have simple standalone example at hand, but I do have hairy real world example — :on-signals in reveal's Vega view that gets notifications from js https://github.com/vlaaad/reveal/blob/master/src/vlaaad/reveal/vega.clj#L199

vlaaad 2022-06-18T06:42:14.441149Z

The idea is that you use .setMember on window object to set there a clojure fn — either during init it as a part of a prop https://github.com/vlaaad/reveal/blob/master/src/vlaaad/reveal/vega.clj#L110

vlaaad 2022-06-18T06:43:57.392889Z

And then .invoke it in js when needed — https://github.com/vlaaad/reveal/blob/master/src/vlaaad/reveal/vega.clj#L129