Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ public static class JSHost
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public sealed class JSFunctionBinding
{
internal JSFunctionBinding() { throw null; }
public static void InvokeJS(JSFunctionBinding signature, Span<JSMarshalerArgument> arguments) { throw null; }
public static JSFunctionBinding BindJSFunction(string functionName, string moduleName, ReadOnlySpan<JSMarshalerType> signatures) { throw null; }
public static JSFunctionBinding BindManagedFunction(string fullyQualifiedName, int signatureHash, ReadOnlySpan<JSMarshalerType> signatures) { throw null; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;


namespace System.Runtime.InteropServices.JavaScript
{
/// <summary>
Expand All @@ -15,8 +16,13 @@ namespace System.Runtime.InteropServices.JavaScript
[CLSCompliant(false)]
[SupportedOSPlatform("browser")]
[EditorBrowsable(EditorBrowsableState.Never)]
public sealed partial class JSFunctionBinding
public sealed class JSFunctionBinding
{
/// <summary>
/// Internal
/// </summary>
internal JSFunctionBinding() { }

#region intentionally opaque internal structure
internal unsafe JSBindingHeader* Header;
internal unsafe JSBindingType* Sigs;// points to first arg, not exception, not result
Expand Down Expand Up @@ -118,6 +124,8 @@ internal unsafe JSBindingType this[int position]
/// Invokes a previously bound JavaScript function using the provided span to transport argument and return values.
/// This API supports JSImport infrastructure and is not intended to be used directly from your code.
/// </summary>
/// <param name="signature">Generated metadata about method signature used for marshaling.</param>
/// <param name="arguments">Intermediate buffer with marshaled arguments.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void InvokeJS(JSFunctionBinding signature, Span<JSMarshalerArgument> arguments)
{
Expand All @@ -128,6 +136,11 @@ public static void InvokeJS(JSFunctionBinding signature, Span<JSMarshalerArgumen
/// Locates and binds a JavaScript function given name and module so that it can later be invoked by managed callers.
/// This API supports JSImport infrastructure and is not intended to be used directly from your code.
/// </summary>
/// <param name="functionName">Name of the exported JavaScript function.</param>
/// <param name="moduleName">Name of the ES6 module</param>
/// <param name="signatures">Metadata about the signature of the marshaled parameters.</param>
/// <returns>Method metadata.</returns>
/// <exception cref="PlatformNotSupportedException">Will be thrown when the method was execute on architecture other than WebAssembly.</exception>
// JavaScriptExports need to be protected from trimming because they are used from C/JS code which IL linker can't see
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicMethods, "System.Runtime.InteropServices.JavaScript.JavaScriptExports", "System.Runtime.InteropServices.JavaScript")]
// TODO make this DynamicDependency conditional
Expand All @@ -144,6 +157,11 @@ public static JSFunctionBinding BindJSFunction(string functionName, string modul
/// Binds a specific managed function wrapper so that it can later be invoked by JavaScript callers.
/// This API supports JSImport infrastructure and is not intended to be used directly from your code.
/// </summary>
/// <param name="fullyQualifiedName">Fully qualified name of the exported method.</param>
/// <param name="signatureHash">Hash of the signature metadata.</param>
/// <param name="signatures">Metadata about the signature of the marshaled parameters.</param>
/// <returns>Method metadata.</returns>
/// <exception cref="PlatformNotSupportedException">Will be thrown when the method was execute on architecture other than WebAssembly.</exception>
public static JSFunctionBinding BindManagedFunction(string fullyQualifiedName, int signatureHash, ReadOnlySpan<JSMarshalerType> signatures)
{
if (RuntimeInformation.OSArchitecture != Architecture.Wasm)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace System.Runtime.InteropServices.JavaScript
public static partial class JSHost
{
/// <summary>
/// Returns a proxy for the <see href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis">globalThis</see> JavaScript host object.
/// Returns a proxy for the <see href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis">globalThis.</see> JavaScript host object.
/// </summary>
public static JSObject GlobalThis
{
Expand All @@ -37,7 +37,7 @@ public static JSObject DotnetInstance
}

/// <summary>
/// Download and instantiate an ES6 module from the provided URL, via the JavaScript host's <see href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import">dynamic import API</see>.
/// Download and instantiate an ES6 module from the provided URL, via the JavaScript host's <see href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import">dynamic import API.</see>.
/// If a module with the provided <paramref name="moduleName"/> has previously been instantiated, it will be returned instead.
/// </summary>
/// <param name="moduleName">Globally unique identifier of the ES6 module, which is used by <see cref="JSImportAttribute(string, string)"/>.</param>
Expand Down
Loading