From 9e92c21a2f39f85ef6dd0ebe555d4bd3de79b4e7 Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Fri, 15 Dec 2017 19:50:36 +0000 Subject: [PATCH] Simplify code by not inlining quite so much --- .../Interop/RegisteredFunction.cs | 23 ++++--------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/src/Microsoft.Blazor.Browser/Interop/RegisteredFunction.cs b/src/Microsoft.Blazor.Browser/Interop/RegisteredFunction.cs index a26f2018af..ab60496b91 100644 --- a/src/Microsoft.Blazor.Browser/Interop/RegisteredFunction.cs +++ b/src/Microsoft.Blazor.Browser/Interop/RegisteredFunction.cs @@ -36,13 +36,8 @@ namespace Microsoft.Blazor.Browser.Interop /// The .NET type corresponding to the function's return value type. /// The identifier used when registering the target function. /// The result of the function invocation. - public static TRes Invoke(string identifier) - { - var result = Runtime.InvokeJS(out var exception, identifier, null, null, null); - return exception != null - ? throw new JavaScriptException(exception) - : result; - } + public static TRes Invoke(string identifier) + => Invoke(identifier, null, null, null); /// /// Invokes the JavaScript function registered with the specified identifier. @@ -53,12 +48,7 @@ namespace Microsoft.Blazor.Browser.Interop /// The first argument. /// The result of the function invocation. public static TRes Invoke(string identifier, T0 arg0) - { - var result = Runtime.InvokeJS(out var exception, identifier, arg0, null, null); - return exception != null - ? throw new JavaScriptException(exception) - : result; - } + => Invoke(identifier, arg0, null, null); /// /// Invokes the JavaScript function registered with the specified identifier. @@ -71,12 +61,7 @@ namespace Microsoft.Blazor.Browser.Interop /// The second argument. /// The result of the function invocation. public static TRes Invoke(string identifier, T0 arg0, T1 arg1) - { - var result = Runtime.InvokeJS(out var exception, identifier, arg0, arg1, null); - return exception != null - ? throw new JavaScriptException(exception) - : result; - } + => Invoke(identifier, arg0, arg1, null); /// /// Invokes the JavaScript function registered with the specified identifier.