diff --git a/samples/MonoSanity/wwwroot/index.html b/samples/MonoSanity/wwwroot/index.html index 52ee7448df..003d37c2fa 100644 --- a/samples/MonoSanity/wwwroot/index.html +++ b/samples/MonoSanity/wwwroot/index.html @@ -28,7 +28,7 @@
+ +Loading...
@@ -54,7 +63,7 @@ var b = parseInt(el('addNumberB').value); var result = invokeMonoMethod('MonoSanityClient', 'MonoSanityClient', 'Examples', 'AddNumbers', [a, b]); el('addNumbersResult').value = result; - } + }; el('repeatString').onsubmit = function (evt) { evt.preventDefault(); @@ -62,7 +71,7 @@ var count = parseInt(el('repeatStringCount').value); var result = invokeMonoMethod('MonoSanityClient', 'MonoSanityClient', 'Examples', 'RepeatString', [str, count]); el('repeatStringResult').value = result; - } + }; el('triggerException').onsubmit = function (evt) { evt.preventDefault(); @@ -73,11 +82,28 @@ } catch (ex) { el('triggerExceptionMessageStackTrace').value = ex.toString(); } - } + }; + + el('callJs').onsubmit = function (evt) { + evt.preventDefault(); + var expression = el('callJsEvalExpression').value; + var result = invokeMonoMethod('MonoSanityClient', 'MonoSanityClient', 'Examples', 'EvaluateJavaScript', [expression]); + el('callJsResult').value = result; + }; function el(id) { return document.getElementById(id); } + + // Examples of functions we can invoke from .NET + + function getUserAgentString() { + return navigator.userAgent; + } + + function triggerJsException() { + throw new Error('This is a JavaScript exception.'); + }