Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: Passing Action/Func into JS?

0
0
Hi again,

If you're using V8, consider upgrading to the just-released ClearScript 5.4.2, which provides a new toFunction method for delegates. This method creates a native JavaScript function that invokes the delegate:
engine.Script.onEvent = new Action<object>(arg => DoSomething(arg));
engine.Execute("eventSource.on('someEvent', onEvent.toFunction())");
This feature might be useful in situations where library code validates functions via typeof or toString().

Good luck!

Viewing all articles
Browse latest Browse all 2297

Latest Images

Trending Articles





Latest Images