V8 engine for .NET applications

    Javascript .NET has appeared in the Codeplex repository  , a project to integrate the  Google V8 engine and provide its interfaces to the CLI system.

    Javascript .NET compiles code on the fly and runs scripts directly from .NET applications. It also allows you to manipulate CLI objects directly from Javascript executable code.

    Code example:
    1. // Initialize the context
    2. JavascriptContext context = new JavascriptContext();
    3.  
    4. // Setting the externals parameters of the context
    5. context.SetParameter("console", new SystemConsole());
    6. context.SetParameter("message", "Hello World !");
    7. context.SetParameter("number", 1);
    8.  
    9. // Running the script
    10. context.Run("var i; for (i = 0; i < 5; i++) console.Print(message + ' (' + i + ')'); number += i;");
    11.  
    12. // Getting a parameter
    13. Console.WriteLine("number: " + context.GetParameter("number"));
    14.  

    Also popular now: