Вопрос

I'm reading this page in my effort to determine if Clojurescript is appropriate for my use case.

I'm interested in using Clojurescript to create the Javascript code that will run in Qt 5 where JS is a native language that can access C++ functions exposed in Qt to the JS layer.

These functions will have names that can be called from Javascript within Qt, but of course they will not exist outside the Qt project, thus creating Javascript code via Clojurescript requires that the Clojurescript can call these functions even though they are outside the scope of the Clojurescript environment.

Does the "extern" method allow for Clojurescript to do this, while maintaining both successful compilation as well as no "munging" of those function names so they can operate in my Qt context fine?

Это было полезно?

Решение

Yes. If you do any optimizations but advanced, externs are not necessary.

If you plan on using the advanced mode, you will need to specify the externs, either manually, using a plugin like lein-externs, or a combination of both.

Another cool thing to do would be generating a full externs from the API docs and publishing them for other people to benefit too. Shouldn't be too hard.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top