I have a problem with the data returned from C # to JS. CefSharp configuration:
Cef.Initialize();
CefSharpSettings.WcfEnabled = true;
CefSharpSettings.LegacyJavascriptBindingEnabled = true;
browser = new ChromiumWebBrowser("")
{
Dock = DockStyle.Fill
};
this.Controls.Add(browser);
SM = new ScriptManager(browser);
browser.RegisterAsyncJsObject("external", SM); //"Support" for C# methods from JavaScript
I am trying to call the C# method from JS:
...
var UserID_array = window.external.loadUsrIDs(usr_names); //usr_name -> array of user names
In C# the declaration of method is as follows:
class ScriptManager
{
...
public int[] loadUsrIDs(object usr_names = null) //by default if usr_names == null then return all user IDs
{
...//reading the database
return id_users.ToArray(); //from List<int> to int[]
}
}
Unfortunately, instead of the Int array (int[]) I always get the following value ([object Promise]) - test code:
var UserID_array = window.external.loadUsrIDs(usr_names);
alert(UserID_array); //alert - only for tests
//Alert function always return value: **[object Promise]**
How do I get access to the returned data by C# method in JS?
Regards
Marcin