Microsoft.JSInterop Namespace

Contains infrastructure for making method calls between .NET and JavaScript in Blazor applications.

Classes

DotNetObjectReference

Provides convenience methods to produce a DotNetObjectReference<TValue>.

DotNetObjectReference<TValue>

Wraps a JS interop argument, indicating that the value should not be serialized as JSON but instead should be passed as a reference.

To avoid leaking memory, the reference must later be disposed by JS code or by .NET code.

DotNetStreamReference

Represents the reference to a .NET stream sent to JavaScript.

JSDisconnectedException

Represents errors that occur during an interop call from .NET to JavaScript when the JavaScript runtime becomes disconnected.

JSException

Represents errors that occur during an interop call from .NET to JavaScript.

JSInProcessObjectReferenceExtensions

Extension methods for IJSInProcessObjectReference.

JSInProcessRuntime

Abstract base class for an in-process JavaScript runtime.

JSInProcessRuntimeExtensions

Extensions for IJSInProcessRuntime.

JSInvokableAttribute

Identifies a .NET method as allowing invocation from JavaScript code. Any method marked with this attribute may receive arbitrary parameter values from untrusted callers. All inputs should be validated carefully.

JSObjectReferenceExtensions

Extensions for IJSObjectReference.

JSRuntime

Abstract base class for a JavaScript runtime.

JSRuntimeExtensions

Extensions for IJSRuntime.

Interfaces

IJSInProcessObjectReference

Represents a reference to a JavaScript object whose functions can be invoked synchronously.

IJSInProcessRuntime

Represents an instance of a JavaScript runtime to which calls may be dispatched.

IJSObjectReference

Represents a reference to a JavaScript object.

IJSRuntime

Represents an instance of a JavaScript runtime to which calls may be dispatched.

IJSStreamReference

Represents a reference to JavaScript data to be consumed through a Stream.

IJSUnmarshalledObjectReference

Represents a reference to a JavaScript object whose functions can be invoked synchronously without JSON marshalling.

IJSUnmarshalledRuntime

Represents an instance of a JavaScript runtime to which calls may be dispatched without JSON marshalling. Not all JavaScript runtimes support this capability. Currently it is only supported on WebAssembly and for security reasons, will never be supported for .NET code that runs on the server. This is an advanced mechanism that should only be used in performance-critical scenarios.

Enums

JSCallResultType

Describes the type of result expected from a JS interop call.

Remarks

For more information about JavaScript interop in Blazor applications, see Call JavaScript functions from .NET methods in ASP.NET Core Blazor and Call .NET methods from JavaScript functions in ASP.NET Core Blazor.