I'm trying out Jint and want to implement the fetch api to use from js. The second argument is a nested js object that is passed in:
fetch('https://example.com', {
method: 'post',
headers : {
authorization : 'xyz'
}
});
What is the signature for the C# function to pass in? I tried
private static string Fetch(string uri, object init)
First and saw Jint passed in an ExpandoObject, I made this:
private static string Fetch(string uri, ExpandoObject init)
But Jint use the JsValue and ObjectInstance object internally right? These also have better sematics to work out is what you got passed in was an object or array etc, but this throws an error:
private static string Fetch(string uri, ObjectInstance init)
: 'No valid constructors found'
What would be the recommended way to pass these objects to C#? I want to have as little friction between the js and C# side of the app as I'll be making quite a few calls back and forth (which is why I'm looking at Jint coming from ClearScript)