Calling a JavaScript function from .NET

You can also call a JavaScript function from .NET.

var engine = new Jurassic.ScriptEngine();
engine.Evaluate("function test(a, b) { return a + b }");
Console.WriteLine(engine.CallGlobalFunction<int>("test", 5, 6));

This code outputs "11" to the console.

Next tutorial: Exposing a .NET class to JavaScript

Last edited Aug 25, 2010 at 1:51 PM by paulbartrum, version 5


No comments yet.