-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Previously the Legacy JavaScript binding behaviour was configured via a global static property CefSharpSettings.LegacyJavascriptBindingEnabled
Now it's configured through JavascriptBindingSettings.LegacyBindingEnabled
which defaults to CefSharpSettings.LegacyJavascriptBindingEnabled.
When LegacyBindingEnabled is enabled, the ResolveObject event will now be called with args.ObjectName == Legacy. Which provides a much more predictable place to register objects with the legacy behaviour.
Example
chromiumWebBrowser.JavascriptObjectRepository.Settings.LegacyBindingEnabled = true;
chromiumWebBrowser.JavascriptObjectRepository.ResolveObject += (s, e) =>
{
if(e.ObjectName == JavascriptObjectRepository.LegacyObjects)
{
//ADD YOUR LEGACY
e.ObjectRepository.Register("myObject", new MyObject(), isAsync:true);
}
};The CefSharpSettings.LegacyJavascriptBindingEnabled property will be removed at some point in the future.
UPDATE
CefSharpSettings.LegacyJavascriptBindingEnabled needs to be set before you create the ChromiumWebBrowser instance to take effect as the JavascriptBindingSettings.LegacyBindingEnabled property is set as part of the JavascriptBindingSettings constructor.
- Raise
ResolveObjectevent withLegacyparam. - Map out how the property will be set in
WPF. Make sure it's usable. - Add Unit test