问题
I created a dynamic object and try to register it with RegisterJsObject. However, the javascript code on the client side doesn't recongize the register js object and I can't call any of the functions that are par tof the dynamic object.
Ex.
C# code:
dynamic obj = new ExpandoObject();
obj.FullName = new Action(() =>
{
Console.WriteLine("FullName method called");
});
Cef.Initialize(new CefSettings());
ChromiumWebBrowser browser = new ChromiumWebBrowser("");
browser.RegisterJsObject("pesonObj", obj);
Javascript Code
personObj.fullName();
Even when I examine the javascript object personObj in a developer's console, it doesn't have the fullName function.
If I create a normal class that isn't dynamic, this isn't the case and works as expected.
So the question is, does Chromium support dynamicObject for registering as javascript objects in the embedded browser.
Any advice appreciated, Thanks, D
来源:https://stackoverflow.com/questions/36489890/dynamicobjects-dont-register-with-registerjsobject-with-chromium-cefsharp