Movatterモバイル変換


[0]ホーム

URL:


Skip to main contentSkip to in-page navigation

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft EdgeMore info about Internet Explorer and Microsoft Edge
Table of contentsExit editor mode

System.Runtime.InteropServices.JavaScript Namespace

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

ContainsJSImportAttribute andJSExportAttribute, which can be used to interop with JavaScript when running in the browser or other WASM architectures.

Classes

NameDescription
JSException

Represents an exception initiated from the JavaScript interop code.

JSExportAttribute

Indicates that a source generator should export the attributed method to JavaScript and create thunks necessary to marshal its arguments and any return value or thrown exception.

JSHost

Represents the JavaScript host environment where the .NET runtime is currently operating.

JSImportAttribute

Indicates that the JSImport source generator should create a managed wrapper to invoke a specific imported JavaScript function and marshal its arguments, return values, and exceptions.

JSMarshalAsAttribute<T>

Specifies the JavaScript type associated with a managed argument or return value.The JSImport generator will use this information to marshal data between the JavaScript and managed environments.

JSObject

Represents a reference to an object in the JavaScript host environment and enables interaction with it as a proxy.

JSType

Used as the generic argument forJSMarshalAsAttribute<T> to express the expected JavaScript type, which should be the source or result of argument marshalling.

JSType.Any

Dynamically selects the most appropriate JavaScript or managed type for each argument value at run time.

JSType.Array<T>

Marshals as a copy of the JavaScriptArray orTypedArray type.

JSType.BigInt

Marshal as JavaScriptBigInt type.

JSType.Boolean

Marshal as JavaScriptBoolean type.

JSType.Date

Marshal as JavaScriptDate type.

JSType.Discard

Suppresses marshalling of the JavaScript function's return value and discards it.

JSType.Error

Marshals as the JavaScriptError type.

JSType.Function

Marshals as the JavaScriptFunction type.

JSType.Function<T>

Marshals as the JavaScriptFunction type.

JSType.Function<T1,T2>

Marshals as the JavaScriptFunction type.

JSType.Function<T1,T2,T3>

Marshals as the JavaScriptFunction type.

JSType.Function<T1,T2,T3,T4>

Marshals as the JavaScriptFunction type.

JSType.MemoryView

Marshals a managed Span or ArraySegment as a JavaScript wrapper object that provides access to the managed memory.

JSType.Number

Marshal as JavaScriptNumber type.

JSType.Object

Marshal as JavaScriptObject type.

JSType.Promise<T>

Marshal as JavaScriptPromise type.

JSType.String

Marshal as JavaScriptString type.

JSType.Void

Asserts that a JavaScript function should have no return value.

Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, seeour contributor guide.

Feedback

Was this page helpful?

YesNoNo

Need help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?

In this article

Was this page helpful?

YesNo
NoNeed help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?