Reputation: 7098
I recently had to take a quick look at Adobe InDesign server. In this enviroment you write your interactions with the servers libs via JavaSscript.
This got me thinking, how could I use the Javascript language within a C# application so that I could expose set bits of functionality of my API/framework and allow others to write small plugins with JavaScript.
As JS is a pretty popular language so I would have thought that I wouldnt have to go writing my own impterpretor or anything, but I could be wrong. Any ideas where I would start with something like this?
Cheers, Chris.
Upvotes: 0
Views: 758
Reputation: 121
Try Javascript .NET:
http://javascriptdotnet.codeplex.com/
It implements Google V8. You can compile and run Javascript directly from .NET code with it, and supply CLI objects to be used by the Javascript code as well. And V8 is probably the best engine ever created in terms of performance, it generates native code from Javascript.
Upvotes: 0
Reputation: 74652
This will be much easier soon when Microsoft releases Managed JScript (http://blogs.msdn.com/deepak/archive/2007/05/02/managed-jscript-is-availaible.aspx)
If you're not beholden to Javascript for now, I'd check out IronPython (http://www.codeplex.com/Wiki/View.aspx?ProjectName=IronPython) - the hosting API is identical to what Microsoft will release for JS and about as easy as it could possibly be, and switching between the 3 DLR languages (IPy, IronRuby, and Managed JS) is trivial.
Edit: Oops, apparently it's available now as part of ASP.NET Futures - I thought it was only in Silverlight; go to it!
Upvotes: 1
Reputation: 827496
Check this question:
Referencing Google’s V8 engine from a .NET app
This article might be interesting:
Evaluating JavaScript code from C# (using MS JScript engine)
Upvotes: 2