Skip to content

Commit e431276

Browse files
committed
API Change - IJavascriptObjectRepository.Register remove isAsync default param
**BREAKING CHANGE** - You must now explicitly specify the `isAsync` param. - Add additional xml doc comment regarding .Net Core and using only isAsync = true The isAsync = false option (sync binding) requires WCF which isn't available on .Net core, remove the default value so you are forced to specify an option and in the process hopefully read the documentation. For those who previously hadn't provided a param then simply pass in false for the third argument. e.g. browser.JavascriptObjectRepository.Register("bound", new BoundObject(), false); Resolves #3016
1 parent 926cd72 commit e431276

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

CefSharp.WinForms.Example/Minimal/SimpleBrowserForm.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using System.ComponentModel;
77
using System.Windows.Forms;
88
using CefSharp.Example.JavascriptBinding;
9-
using CefSharp.WinForms.Internals;
109

1110
namespace CefSharp.WinForms.Example.Minimal
1211
{
@@ -68,7 +67,7 @@ private void CreateBrowser()
6867
browser.StatusMessage += OnBrowserStatusMessage;
6968
browser.TitleChanged += OnBrowserTitleChanged;
7069
browser.AddressChanged += OnBrowserAddressChanged;
71-
browser.JavascriptObjectRepository.Register("bound", new BoundObject());
70+
browser.JavascriptObjectRepository.Register("bound", new BoundObject(), false);
7271
if (!multiThreadedMessageLoop)
7372
{
7473
browser.FocusHandler = null;

CefSharp.Wpf.Example/JavascriptCallbackMainWindow.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ public JavascriptCallbackMainWindow()
1919
boundObjectOne = new JavascriptCallbackBoundObject(BrowserOne);
2020
boundObjectTwo = new JavascriptCallbackBoundObject(BrowserTwo);
2121

22-
BrowserOne.JavascriptObjectRepository.Register("boundObject", boundObjectOne);
23-
BrowserTwo.JavascriptObjectRepository.Register("boundObject", boundObjectTwo);
22+
BrowserOne.JavascriptObjectRepository.Register("boundObject", boundObjectOne, false);
23+
BrowserTwo.JavascriptObjectRepository.Register("boundObject", boundObjectTwo, false);
2424
}
2525

2626
private void ExecuteCallbackImmediatelyClick(object sender, RoutedEventArgs e)

CefSharp/IJavascriptObjectRepository.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ public interface IJavascriptObjectRepository : IDisposable
3030
/// only methods will be exposed and when called from javascript will return a Promise to be awaited.
3131
/// This method is newer and recommended for everyone starting out as it is faster and more reliable.
3232
/// If false then methods and properties will be registered, this method relies on a WCF service to communicate.
33+
/// If you are targeting .Net Core then you can only use isAsync = true as Microsoft has chosen not to support WCF.
3334
/// </param>
3435
/// <param name="options">binding options, by default method/property names are camelCased, you can control this
3536
/// and other advanced options though this class.</param>
36-
void Register(string name, object objectToBind, bool isAsync = false, BindingOptions options = null);
37+
void Register(string name, object objectToBind, bool isAsync, BindingOptions options = null);
3738
/// <summary>
3839
/// UnRegister all the currently bound objects from the repository. If you unregister an object that is currently
3940
/// bound in JavaScript then the method/property calls will fail.

0 commit comments

Comments
 (0)