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');