Maybe its c# application
interaction with javascrip
t, use jint.dll
for this
Jint - Javascript Interpreter for .NET
Example
Listed below are the java script functions
function reverse(my_str) { var sb = new jintTestApplication.Test();//jintTestApplication is the namespace name return sb.Test1(reverse2(my_str) ); } function reverse2(my_str) { var comStr=""; var result=""; var i=my_str.length; i=i-1; for (var x = i; x >=0; x--) { result= my_str.charAt(x); comStr+=result; } return comStr; }
so in this case you need to create an object of your class inside javascript and you can call the C # method
JintEngine engine = new JintEngine(); engine.Run(ReadJavaScript()); Console.WriteLine(engine.Run("reverse('Foooooo');")); public static string ReadJavaScript() { string allines = File.ReadAllText(@"[path]\test.js"); } public void Test1(string message) { MessageBox.show(message); }
source share