Share via


JSRuntime Class

Definition

Abstract base class for a JavaScript runtime.

public ref class JSRuntime abstract : Microsoft::JSInterop::IJSRuntime
public abstract class JSRuntime : Microsoft.JSInterop.IJSRuntime
public abstract class JSRuntime : IDisposable, Microsoft.JSInterop.IJSRuntime
type JSRuntime = class
    interface IJSRuntime
type JSRuntime = class
    interface IJSRuntime
    interface IDisposable
Public MustInherit Class JSRuntime
Implements IJSRuntime
Public MustInherit Class JSRuntime
Implements IDisposable, IJSRuntime
Inheritance
JSRuntime
Derived
Implements

Constructors

JSRuntime()

Initializes a new instance of JSRuntime.

Properties

DefaultAsyncTimeout

Gets or sets the default timeout for asynchronous JavaScript calls.

JsonSerializerOptions

Gets the JsonSerializerOptions used to serialize and deserialize interop payloads.

Methods

BeginInvokeJS(Int64, String, String, JSCallResultType, Int64)

Begins an asynchronous function invocation.

BeginInvokeJS(Int64, String, String)

Begins an asynchronous function invocation.

Dispose()

Dispose the JSRuntime.

EndInvokeDotNet(DotNetInvocationInfo, DotNetInvocationResult)

Completes an async JS interop call from JavaScript to .NET

InvokeAsync<TValue>(String, CancellationToken, Object[])

Invokes the specified JavaScript function asynchronously.

InvokeAsync<TValue>(String, Object[])

Invokes the specified JavaScript function asynchronously.

JSRuntime will apply timeouts to this operation based on the value configured in DefaultAsyncTimeout. To dispatch a call with a different, or no timeout, consider using InvokeAsync<TValue>(String, CancellationToken, Object[]).

ReadJSDataAsStreamAsync(IJSStreamReference, Int64, CancellationToken)

Provides a Stream for the data reference represented by jsStreamReference.

ReceiveByteArray(Int32, Byte[])

Accepts the byte array data being transferred from JS to DotNet.

SendByteArray(Int32, Byte[])

Transfers a byte array from .NET to JS.

TransmitStreamAsync(Int64, DotNetStreamReference)

Transmits the stream data from .NET to JS. Subclasses should override this method and provide an implementation that transports the data to JS and calls DotNet.jsCallDispatcher.supplyDotNetStream.

Extension Methods

InvokeAsync<TValue>(IJSRuntime, String, Object[])

Invokes the specified JavaScript function asynchronously.

JSRuntime will apply timeouts to this operation based on the value configured in DefaultAsyncTimeout. To dispatch a call with a different timeout, or no timeout, consider using InvokeAsync<TValue>(String, CancellationToken, Object[]).

InvokeAsync<TValue>(IJSRuntime, String, CancellationToken, Object[])

Invokes the specified JavaScript function asynchronously.

InvokeAsync<TValue>(IJSRuntime, String, TimeSpan, Object[])

Invokes the specified JavaScript function asynchronously.

InvokeVoidAsync(IJSRuntime, String, Object[])

Invokes the specified JavaScript function asynchronously.

InvokeVoidAsync(IJSRuntime, String, CancellationToken, Object[])

Invokes the specified JavaScript function asynchronously.

InvokeVoidAsync(IJSRuntime, String, TimeSpan, Object[])

Invokes the specified JavaScript function asynchronously.

Applies to