C # + IE9 JS Engine Chakra?

I am working on a cool C # application that uses JS a lot for our model layer. We would like to use the IE9 Chakra Javascript engine to increase speed.

Questions:

  • Is it possible to use Chakra in C # and interact with JS objects as COM objects? (to call functions on JS objects)
  • Can I install Chakra separately from IE9? (some users do not have IE9, so it would be easier if they did not have to install IE9, but just Chakra).

Thanks so much for your experience.

+4
source share
2 answers

[Update] Based on Cheeso's answer, it seems like you can use the IE9 JS engine [/ Update]. However, I found that the JavaScript V8 engine (Chrome JS engine) mentions that you can use the V8 engine in your C ++ application. Follow the V8 Implementation Guide to learn more. I did not find a link mentioning the use of V8 functions through the COM interface, so you cannot use it with C #.

+2
source

Answer to Q # 1

Yes, you can interact with Javascript logic working in Chakra with C # through COM.

In particular, from a C # program, you can run Chakra through IActiveScript, load some Javascript / ES5 code into it, and then call the methods defined in this Javascript using the COM IDispatch pointer.

Connected:

Answer to Q # 2

As far as I know, no, you cannot install Chakra without installing IE9. However, you can design your C # application to gracefully degrade to use the existing JScript engine for computers without a chakra.

+7
source

Source: https://habr.com/ru/post/1345202/


All Articles