Files
cefsharp/CefSharp.Wpf.Example/JavascriptCallbackMainWindow.xaml.cs
T
amaitland e4312760ce 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
2020-01-21 08:39:23 +10:00

49 lines
1.5 KiB
C#

using System.Threading.Tasks;
using System.Windows;
using CefSharp.Example.JavascriptBinding;
namespace CefSharp.Wpf.Example
{
/// <summary>
/// Interaction logic for JavascriptCallbackMainWindow.xaml
/// </summary>
public partial class JavascriptCallbackMainWindow : Window
{
private JavascriptCallbackBoundObject boundObjectOne;
private JavascriptCallbackBoundObject boundObjectTwo;
public JavascriptCallbackMainWindow()
{
InitializeComponent();
boundObjectOne = new JavascriptCallbackBoundObject(BrowserOne);
boundObjectTwo = new JavascriptCallbackBoundObject(BrowserTwo);
BrowserOne.JavascriptObjectRepository.Register("boundObject", boundObjectOne, false);
BrowserTwo.JavascriptObjectRepository.Register("boundObject", boundObjectTwo, false);
}
private void ExecuteCallbackImmediatelyClick(object sender, RoutedEventArgs e)
{
boundObjectOne.RunCallback();
boundObjectTwo.RunCallback();
BrowserOne.Reload();
BrowserTwo.Reload();
}
private void ExecuteCallbackInThreeSeconds(object sender, RoutedEventArgs e)
{
BrowserOne.Address = "custom://cefsharp/SchemeTest.html";
BrowserTwo.Address = "custom://cefsharp/SchemeTest.html";
Task.Delay(3000).ContinueWith(t =>
{
boundObjectOne.RunCallback();
boundObjectTwo.RunCallback();
});
}
}
}