diff --git a/src/Components/WebAssembly/JSInterop/src/WebAssemblyJSRuntime.cs b/src/Components/WebAssembly/JSInterop/src/WebAssemblyJSRuntime.cs
index 435c49afb2..783dbb1082 100644
--- a/src/Components/WebAssembly/JSInterop/src/WebAssemblyJSRuntime.cs
+++ b/src/Components/WebAssembly/JSInterop/src/WebAssemblyJSRuntime.cs
@@ -42,41 +42,6 @@ namespace Microsoft.JSInterop.WebAssembly
BeginInvokeJS(0, "DotNet.jsCallDispatcher.endInvokeDotNetFromJS", args);
}
- #region Custom WebAssemblyJSRuntime methods
-
- ///
- /// Invokes the JavaScript function registered with the specified identifier.
- ///
- /// 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 TResult InvokeUnmarshalled(string identifier)
- => InvokeUnmarshalled(identifier, null, null, null);
-
- ///
- /// Invokes the JavaScript function registered with the specified identifier.
- ///
- /// The type of the first argument.
- /// The .NET type corresponding to the function's return value type.
- /// The identifier used when registering the target function.
- /// The first argument.
- /// The result of the function invocation.
- public TResult InvokeUnmarshalled(string identifier, T0 arg0)
- => InvokeUnmarshalled(identifier, arg0, null, null);
-
- ///
- /// Invokes the JavaScript function registered with the specified identifier.
- ///
- /// The type of the first argument.
- /// The type of the second argument.
- /// The .NET type corresponding to the function's return value type.
- /// The identifier used when registering the target function.
- /// The first argument.
- /// The second argument.
- /// The result of the function invocation.
- public TResult InvokeUnmarshalled(string identifier, T0 arg0, T1 arg1)
- => InvokeUnmarshalled(identifier, arg0, arg1, null);
-
///
/// Invokes the JavaScript function registered with the specified identifier.
///
@@ -96,7 +61,5 @@ namespace Microsoft.JSInterop.WebAssembly
? throw new JSException(exception)
: result;
}
-
- #endregion
}
}
diff --git a/src/Components/WebAssembly/JSInterop/src/WebAssemblyJSRuntimeExtensions.cs b/src/Components/WebAssembly/JSInterop/src/WebAssemblyJSRuntimeExtensions.cs
new file mode 100644
index 0000000000..4ba4de1266
--- /dev/null
+++ b/src/Components/WebAssembly/JSInterop/src/WebAssemblyJSRuntimeExtensions.cs
@@ -0,0 +1,70 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System;
+
+namespace Microsoft.JSInterop.WebAssembly
+{
+ ///
+ /// Extension methods for .
+ ///
+ public static class WebAssemblyJSRuntimeExtensions
+ {
+ ///
+ /// Invokes the JavaScript function registered with the specified identifier.
+ ///
+ /// The .NET type corresponding to the function's return value type.
+ /// The .
+ /// The identifier used when registering the target function.
+ /// The result of the function invocation.
+ public static TResult InvokeUnmarshalled(this WebAssemblyJSRuntime jsRuntime, string identifier)
+ {
+ if (jsRuntime is null)
+ {
+ throw new ArgumentNullException(nameof(jsRuntime));
+ }
+
+ return jsRuntime.InvokeUnmarshalled(identifier, null, null, null);
+ }
+
+ ///
+ /// Invokes the JavaScript function registered with the specified identifier.
+ ///
+ /// The type of the first argument.
+ /// The .NET type corresponding to the function's return value type.
+ /// The .
+ /// The identifier used when registering the target function.
+ /// The first argument.
+ /// The result of the function invocation.
+ public static TResult InvokeUnmarshalled(this WebAssemblyJSRuntime jsRuntime, string identifier, T0 arg0)
+ {
+ if (jsRuntime is null)
+ {
+ throw new ArgumentNullException(nameof(jsRuntime));
+ }
+
+ return jsRuntime.InvokeUnmarshalled(identifier, arg0, null, null);
+ }
+
+ ///
+ /// Invokes the JavaScript function registered with the specified identifier.
+ ///
+ /// The type of the first argument.
+ /// The type of the second argument.
+ /// The .NET type corresponding to the function's return value type.
+ /// The .
+ /// The identifier used when registering the target function.
+ /// The first argument.
+ /// The second argument.
+ /// The result of the function invocation.
+ public static TResult InvokeUnmarshalled(this WebAssemblyJSRuntime jsRuntime, string identifier, T0 arg0, T1 arg1)
+ {
+ if (jsRuntime is null)
+ {
+ throw new ArgumentNullException(nameof(jsRuntime));
+ }
+
+ return jsRuntime.InvokeUnmarshalled(identifier, arg0, arg1, null);
+ }
+ }
+}
diff --git a/src/Components/WebAssembly/WebAssembly/src/Rendering/WebAssemblyRenderer.cs b/src/Components/WebAssembly/WebAssembly/src/Rendering/WebAssemblyRenderer.cs
index 8615b05847..d9e81acf15 100644
--- a/src/Components/WebAssembly/WebAssembly/src/Rendering/WebAssemblyRenderer.cs
+++ b/src/Components/WebAssembly/WebAssembly/src/Rendering/WebAssemblyRenderer.cs
@@ -7,6 +7,7 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Components.RenderTree;
using Microsoft.AspNetCore.Components.WebAssembly.Services;
using Microsoft.Extensions.Logging;
+using Microsoft.JSInterop.WebAssembly;
namespace Microsoft.AspNetCore.Components.WebAssembly.Rendering
{