just wondering if anyone has ever tried embedding and actually integrating any js engine into the .net environment. I could find and actually use (after a LOT of pain and effort, since it's pretty outdated and not quite finished) spidermonkey-dotnet project. Anyone with experience in this area? Engines like SquirrelFish, V8..
Not that I'm not satisfied with Mozilla's Spidermonkey (using it for Rails-like miniframework for custom components inside the core ASP.NET application), but I'd still love to explore a bit further with the options. The command-line solutions are not what I'd need, I cannot rely on anything else than CLR, I need to call methods from/to JavaScript/C# objects.
// c# class
public class A
{
public string Hello(string msg)
{
return msg + " whatewer";
}
}
// js snippet
var a = new A();
console.log(a.Hello('Call me')); // i have a console.log implemented, don't worry, it's not a client-side code :)
Just to clarify - I'm not trying to actually program the application itself in server-side javascript. It's used solely for writing custom user subapplications (can be seen as some sort of DSL). It's much easier (and safer) to allow normal people programming in js than C#.
If the language isn't a problem (any sandboxed scripted one) then there's LUA for .NET. The Silverlight version of the .NET framework is also sandboxed afaik.
You can use the Chakra engine in C#. Here is an article on msdn showing how:
http://code.msdn.microsoft.com/windowsdesktop/JavaScript-Runtime-Hosting-d3a13880
Anybody just tuning in check out Jurassic as well:
http://jurassic.codeplex.com/
edit: this has moved to github (and seems active at first glance)
https://github.com/paulbartrum/jurassic
You can try ironJS, looks promising although it is in heavy development. https://github.com/fholm/IronJS