Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# + IE9 JS Engine Chakra?

I'm working on a cool C# app, which uses JS a lot for our model layer. We would like to use the IE9 Chakra Javascript engine for speed improvements.

Questions:

  • Can I 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 installed, so it would be easier if they did not have to install IE9, but just Chakra).

Thanks a lot in advance for you expertise.

like image 409
Bodekaer Avatar asked Jan 21 '23 04:01

Bodekaer


1 Answers

Answer to Q#1

Yes, you can interact with Javascript logic running in Chakra from C# via COM.

in Particular, from a c# program, you can startup Chakra via IActiveScript, load some Javascript/ES5 code into it, then invoke methods defined in that Javascript code via a COM IDispatch pointer.

Related:

  • Will the IE10 Chakra JScript engine available as stand alone accessible from C#?
  • What is the ProgId or CLSID for IE9's Javascript engine (code-named "Chakra")

Answer to Q#2

As far as I know, NO, you cannot install Chakra without installing IE9. You can design your C# app, though, to gracefully degrade to use the existing JScript engine, for computers without Chakra.

like image 170
Cheeso Avatar answered Jan 24 '23 00:01

Cheeso