|
We are trying to use Jurassic to run our unit tests as part of our build process.
We would like to be able to support some browser functionality like window.setTimeout as objects in our space.
We have it so that it succesfully calls back to a C# object we have written, but we need a way of passing a javascript callback to the setTimer function that we call back when the appropriaate amount of time has changed.
Our current code likes something like this:
[JSFunction]
public int setTimeout(ObjectInstance callback, int millisec, string lang = null)
{
Timer timer = new Timer(obj => this.Engine.CallGlobalFunction(callback), callback, millisec, Timeout.Infinite);
return id;
}
Only problem is that the callback which is passed in comes in as a string which is the serialized form of the entire function.
Is there a recommended way of accomplishing this?
Thanks
|