I'm going to talk about the Javascript .NET open source project that can be found on Codeplex (http://javascriptdotnet.codeplex.com) develop by Noesis Innovation. It has been released in July 2010 and it looks very promising overall.
// Initialize the context
JavascriptContext context = new JavascriptContext();
// Setting the externals parameters of the context
context.SetParameter("console", new SystemConsole());
context.SetParameter("message", "Hello World !");
context.SetParameter("number", 1);
// Running the script
context.Run("var i; for (i = 0; i < 5; i++) console.Print(message + ' (' + i + ')'); number += i;");
// Getting a parameter
Console.WriteLine("number: " + context.GetParameter("number"));
Basically, they took the v8 Google Javascript engine and exposed it to CLI with managed C++ since v8 is pure C++. It also exposed the CLI objects to the Javascript, which is pretty damn sweet if you ask me. Even though it doesn't include all the CLI objects available yet since the project has just been released, but it supports the most important ones like your own implemented class, System::Array, System::Dictionary and System::List. It works pretty smoothly and a community is building little by little around it so the issues are tracked and handled more easily to make the project more stable.Overall, it's really easy to use if you're familiar with .NET, you just put your Javascript in a context and boom it just works like it is. I'm looking forward to some more sweet improvements.
So that's it ! Later.
0 comments:
Post a Comment