From df1ab21c01ea32394b6091aede52528e2b8fb9ab Mon Sep 17 00:00:00 2001 From: amaitland Date: Wed, 7 Feb 2018 10:16:19 +1000 Subject: [PATCH] ScriptedMethodsTest.html - Update to use JSB v2 CefSharp.BindObjectAsync --- CefSharp.Example/Resources/ScriptedMethodsTest.html | 7 +++++-- CefSharp.Example/ScriptedMethods.cs | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CefSharp.Example/Resources/ScriptedMethodsTest.html b/CefSharp.Example/Resources/ScriptedMethodsTest.html index 43fbc47a6..ccc17f1df 100644 --- a/CefSharp.Example/Resources/ScriptedMethodsTest.html +++ b/CefSharp.Example/Resources/ScriptedMethodsTest.html @@ -31,11 +31,14 @@

1Javascript code that adds a click event listener and passes event data to .Net when the event occurs.

-            (function () {
+            (async function ()
+            {
+                await CefSharp.BindObjectAsync("boundEvent");
                 var counter = 0;
                 var elem = document.getElementById('test-button');
                 elem.removeAttribute('disabled');
-                elem.addEventListener('click', function(e){
+                elem.addEventListener('click', function(e)
+                {
                     if (!window.boundEvent){
                         console.log('window.boundEvent does not exist.');
                         return;
diff --git a/CefSharp.Example/ScriptedMethods.cs b/CefSharp.Example/ScriptedMethods.cs
index cb07098e8..613964b53 100644
--- a/CefSharp.Example/ScriptedMethods.cs
+++ b/CefSharp.Example/ScriptedMethods.cs
@@ -119,7 +119,9 @@ namespace CefSharp.Example
             // Scripts should be minified for production builds. The script
             // could also be read from a file...
             var script =
-                @"(function () {
+                @"(async function ()
+                {
+                    await CefSharp.BindObjectAsync('boundEvent');
                     var counter = 0;
                     var elem = document.getElementById('##ID##');
                     elem.removeAttribute('disabled');