diff --git a/src/Components/Endpoints/src/DependencyInjection/UnsupportedJavaScriptRuntime.cs b/src/Components/Endpoints/src/DependencyInjection/UnsupportedJavaScriptRuntime.cs index d5a261a725f0..028e9da2684b 100644 --- a/src/Components/Endpoints/src/DependencyInjection/UnsupportedJavaScriptRuntime.cs +++ b/src/Components/Endpoints/src/DependencyInjection/UnsupportedJavaScriptRuntime.cs @@ -17,10 +17,10 @@ internal sealed class UnsupportedJavaScriptRuntime : IJSRuntime ValueTask IJSRuntime.InvokeAsync<[DynamicallyAccessedMembers(JsonSerialized)] TValue>(string identifier, object?[]? args) => throw new InvalidOperationException(Message); - public ValueTask InvokeNewAsync(string identifier, object?[]? args) + public ValueTask InvokeConstructorAsync(string identifier, object?[]? args) => throw new InvalidOperationException(Message); - public ValueTask InvokeNewAsync(string identifier, CancellationToken cancellationToken, object?[]? args) + public ValueTask InvokeConstructorAsync(string identifier, CancellationToken cancellationToken, object?[]? args) => throw new InvalidOperationException(Message); public ValueTask GetValueAsync<[DynamicallyAccessedMembers(JsonSerialized)] TValue>(string identifier) diff --git a/src/Components/Server/test/ProtectedBrowserStorageTest.cs b/src/Components/Server/test/ProtectedBrowserStorageTest.cs index e42734f2bac1..0b0c7d426bde 100644 --- a/src/Components/Server/test/ProtectedBrowserStorageTest.cs +++ b/src/Components/Server/test/ProtectedBrowserStorageTest.cs @@ -365,15 +365,15 @@ public ValueTask InvokeAsync(string identifier, CancellationToke public ValueTask InvokeAsync(string identifier, object[] args) => InvokeAsync(identifier, cancellationToken: CancellationToken.None, args: args); - public ValueTask InvokeNewAsync(string identifier, object[] args) + public ValueTask InvokeConstructorAsync(string identifier, object[] args) { - Invocations.Add((identifier, args, JSCallType.NewCall)); + Invocations.Add((identifier, args, JSCallType.ConstructorCall)); return (ValueTask)NextInvocationResult; } - public ValueTask InvokeNewAsync(string identifier, CancellationToken cancellationToken, object[] args) + public ValueTask InvokeConstructorAsync(string identifier, CancellationToken cancellationToken, object[] args) { - Invocations.Add((identifier, args, JSCallType.NewCall)); + Invocations.Add((identifier, args, JSCallType.ConstructorCall)); return (ValueTask)NextInvocationResult; } diff --git a/src/Components/WebAssembly/WebAssembly.Authentication/test/RemoteAuthenticationServiceTests.cs b/src/Components/WebAssembly/WebAssembly.Authentication/test/RemoteAuthenticationServiceTests.cs index 9477611fafde..5d00fb83b04c 100644 --- a/src/Components/WebAssembly/WebAssembly.Authentication/test/RemoteAuthenticationServiceTests.cs +++ b/src/Components/WebAssembly/WebAssembly.Authentication/test/RemoteAuthenticationServiceTests.cs @@ -549,10 +549,10 @@ public ValueTask GetValueAsync(string identifier) public ValueTask GetValueAsync(string identifier, CancellationToken cancellationToken) => throw new NotImplementedException(); - public ValueTask InvokeNewAsync(string identifier, object[] args) + public ValueTask InvokeConstructorAsync(string identifier, object[] args) => throw new NotImplementedException(); - public ValueTask InvokeNewAsync(string identifier, CancellationToken cancellationToken, object[] args) + public ValueTask InvokeConstructorAsync(string identifier, CancellationToken cancellationToken, object[] args) => throw new NotImplementedException(); public ValueTask SetValueAsync(string identifier, TValue value) diff --git a/src/Components/WebAssembly/WebAssembly.Authentication/test/RemoteAuthenticatorCoreTests.cs b/src/Components/WebAssembly/WebAssembly.Authentication/test/RemoteAuthenticatorCoreTests.cs index 20ac527d6247..694e3aea29f4 100644 --- a/src/Components/WebAssembly/WebAssembly.Authentication/test/RemoteAuthenticatorCoreTests.cs +++ b/src/Components/WebAssembly/WebAssembly.Authentication/test/RemoteAuthenticatorCoreTests.cs @@ -790,10 +790,10 @@ public ValueTask InvokeAsync(string identifier, CancellationToke return default; } - public ValueTask InvokeNewAsync(string identifier, object[] args) + public ValueTask InvokeConstructorAsync(string identifier, object[] args) => throw new NotImplementedException(); - public ValueTask InvokeNewAsync(string identifier, CancellationToken cancellationToken, object[] args) + public ValueTask InvokeConstructorAsync(string identifier, CancellationToken cancellationToken, object[] args) => throw new NotImplementedException(); public ValueTask GetValueAsync(string identifier) diff --git a/src/Components/WebAssembly/WebAssembly/test/PullFromJSDataStreamTest.cs b/src/Components/WebAssembly/WebAssembly/test/PullFromJSDataStreamTest.cs index c84f9c5b1798..bfe0f0f7a55a 100644 --- a/src/Components/WebAssembly/WebAssembly/test/PullFromJSDataStreamTest.cs +++ b/src/Components/WebAssembly/WebAssembly/test/PullFromJSDataStreamTest.cs @@ -133,10 +133,10 @@ public virtual ValueTask InvokeAsync(string identifier, Cancella public async ValueTask InvokeAsync(string identifier, object[] args) => await InvokeAsync(identifier, CancellationToken.None, args); - public ValueTask InvokeNewAsync(string identifier, object[] args) + public ValueTask InvokeConstructorAsync(string identifier, object[] args) => throw new NotImplementedException(); - public ValueTask InvokeNewAsync(string identifier, CancellationToken cancellationToken, object[] args) + public ValueTask InvokeConstructorAsync(string identifier, CancellationToken cancellationToken, object[] args) => throw new NotImplementedException(); public ValueTask GetValueAsync(string identifier) diff --git a/src/Components/test/E2ETest/Tests/InteropTest.cs b/src/Components/test/E2ETest/Tests/InteropTest.cs index b98fb69d72f1..ef7d9fe18963 100644 --- a/src/Components/test/E2ETest/Tests/InteropTest.cs +++ b/src/Components/test/E2ETest/Tests/InteropTest.cs @@ -102,11 +102,11 @@ public void CanInvokeInteropMethods() ["setValueToSetterAsync"] = "40", ["setValueToUndefinedPropertyAsync"] = "50", ["setValueToGetterAsync"] = "Success", - // InvokeNew tests - ["invokeNewWithClassConstructorAsync"] = "Success", - ["invokeNewWithClassConstructorAsync.dataProperty"] = "abraka", - ["invokeNewWithClassConstructorAsync.function"] = "6", - ["invokeNewWithNonConstructorAsync"] = "Success", + // InvokeConstructor tests + ["invokeConstructorWithClassConstructorAsync"] = "Success", + ["invokeConstructorWithClassConstructorAsync.dataProperty"] = "abraka", + ["invokeConstructorWithClassConstructorAsync.function"] = "6", + ["invokeConstructorWithNonConstructorAsync"] = "Success", // Function reference tests ["changeFunctionViaObjectReferenceAsync"] = "42" }; @@ -168,11 +168,11 @@ public void CanInvokeInteropMethods() ["setValueToSetter"] = "40", ["setValueToUndefinedProperty"] = "50", ["setValueToGetter"] = "Success", - // InvokeNew tests - ["invokeNewWithClassConstructor"] = "Success", - ["invokeNewWithClassConstructor.dataProperty"] = "abraka", - ["invokeNewWithClassConstructor.function"] = "6", - ["invokeNewWithNonConstructor"] = "Success", + // InvokeConstructor tests + ["invokeConstructorWithClassConstructor"] = "Success", + ["invokeConstructorWithClassConstructor.dataProperty"] = "abraka", + ["invokeConstructorWithClassConstructor.function"] = "6", + ["invokeConstructorWithNonConstructor"] = "Success", // Function reference tests ["changeFunctionViaObjectReference"] = "42" }; diff --git a/src/Components/test/testassets/BasicTestApp/DotNetToJSInterop.razor b/src/Components/test/testassets/BasicTestApp/DotNetToJSInterop.razor index b57a78849eda..624e8bbfb175 100644 --- a/src/Components/test/testassets/BasicTestApp/DotNetToJSInterop.razor +++ b/src/Components/test/testassets/BasicTestApp/DotNetToJSInterop.razor @@ -90,8 +90,8 @@
- - + + @InstanceMessage
@@ -147,13 +147,13 @@ private async Task CreateInstanceByConstructorFunction() { - var dogRef = await JSRuntime.InvokeNewAsync("Dog", "A dog"); + var dogRef = await JSRuntime.InvokeConstructorAsync("Dog", "A dog"); InstanceMessage = await dogRef.InvokeAsync("bark"); } private async Task CreateInstanceByClassConstructor() { - var catRef = await JSRuntime.InvokeNewAsync("Cat", "A cat"); + var catRef = await JSRuntime.InvokeConstructorAsync("Cat", "A cat"); InstanceMessage = await catRef.InvokeAsync("meow"); } @@ -169,9 +169,9 @@ private async Task ChangeInstanceMethodWithFunctionReference() { - var dogRef = await JSRuntime.InvokeNewAsync("Dog", "A dog"); + var dogRef = await JSRuntime.InvokeConstructorAsync("Dog", "A dog"); var dogFuncRef = await dogRef.GetValueAsync("bark"); - var catRef = await JSRuntime.InvokeNewAsync("Cat", "A cat"); + var catRef = await JSRuntime.InvokeConstructorAsync("Cat", "A cat"); await catRef.SetValueAsync("meow", dogFuncRef); InstanceMessage = await catRef.InvokeAsync("meow"); } diff --git a/src/Components/test/testassets/BasicTestApp/InteropComponent.razor b/src/Components/test/testassets/BasicTestApp/InteropComponent.razor index 92d845d42571..eb7839539d54 100644 --- a/src/Components/test/testassets/BasicTestApp/InteropComponent.razor +++ b/src/Components/test/testassets/BasicTestApp/InteropComponent.razor @@ -294,11 +294,11 @@ SetValueTests(); } - await InvokeNewAsyncTests(); + await InvokeConstructorAsyncTests(); if (shouldSupportSyncInterop) { - InvokeNewTests(); + InvokeConstructorTests(); } await FunctionReferenceAsyncTests(); @@ -560,58 +560,58 @@ } } - private async Task InvokeNewAsyncTests() + private async Task InvokeConstructorAsyncTests() { - var testClassRef = await JSRuntime.InvokeNewAsync("jsInteropTests.TestClass", "abraka"); + var testClassRef = await JSRuntime.InvokeConstructorAsync("jsInteropTests.TestClass", "abraka"); - ReturnValues["invokeNewWithClassConstructorAsync"] = testClassRef is IJSObjectReference ? "Success" : "Failure"; - ReturnValues["invokeNewWithClassConstructorAsync.dataProperty"] = await testClassRef.GetValueAsync("text"); - ReturnValues["invokeNewWithClassConstructorAsync.function"] = (await testClassRef.InvokeAsync("getTextLength")).ToString(); + ReturnValues["invokeConstructorWithClassConstructorAsync"] = testClassRef is IJSObjectReference ? "Success" : "Failure"; + ReturnValues["invokeConstructorWithClassConstructorAsync.dataProperty"] = await testClassRef.GetValueAsync("text"); + ReturnValues["invokeConstructorWithClassConstructorAsync.function"] = (await testClassRef.InvokeAsync("getTextLength")).ToString(); try { - var nonConstructorRef = await JSRuntime.InvokeNewAsync("jsInteropTests.nonConstructorFunction"); - ReturnValues["invokeNewWithNonConstructorAsync"] = nonConstructorRef is null ? "Failure: null" : "Failure: not null"; + var nonConstructorRef = await JSRuntime.InvokeConstructorAsync("jsInteropTests.nonConstructorFunction"); + ReturnValues["invokeConstructorWithNonConstructorAsync"] = nonConstructorRef is null ? "Failure: null" : "Failure: not null"; } catch (JSException) { - ReturnValues["invokeNewWithNonConstructorAsync"] = "Success"; + ReturnValues["invokeConstructorWithNonConstructorAsync"] = "Success"; } catch (Exception ex) { - ReturnValues["invokeNewWithNonConstructorAsync"] = $"Failure: {ex.Message}"; + ReturnValues["invokeConstructorWithNonConstructorAsync"] = $"Failure: {ex.Message}"; } } - private void InvokeNewTests() + private void InvokeConstructorTests() { var inProcRuntime = ((IJSInProcessRuntime)JSRuntime); - var testClassRef = inProcRuntime.InvokeNew("jsInteropTests.TestClass", "abraka"); + var testClassRef = inProcRuntime.InvokeConstructor("jsInteropTests.TestClass", "abraka"); - ReturnValues["invokeNewWithClassConstructor"] = testClassRef is IJSInProcessObjectReference ? "Success" : "Failure"; - ReturnValues["invokeNewWithClassConstructor.dataProperty"] = testClassRef.GetValue("text"); - ReturnValues["invokeNewWithClassConstructor.function"] = testClassRef.Invoke("getTextLength").ToString(); + ReturnValues["invokeConstructorWithClassConstructor"] = testClassRef is IJSInProcessObjectReference ? "Success" : "Failure"; + ReturnValues["invokeConstructorWithClassConstructor.dataProperty"] = testClassRef.GetValue("text"); + ReturnValues["invokeConstructorWithClassConstructor.function"] = testClassRef.Invoke("getTextLength").ToString(); try { - var nonConstructorRef = inProcRuntime.InvokeNew("jsInteropTests.nonConstructorFunction"); - ReturnValues["invokeNewWithNonConstructor"] = nonConstructorRef is null ? "Failure: null" : "Failure: not null"; + var nonConstructorRef = inProcRuntime.InvokeConstructor("jsInteropTests.nonConstructorFunction"); + ReturnValues["invokeConstructorWithNonConstructor"] = nonConstructorRef is null ? "Failure: null" : "Failure: not null"; } catch (JSException) { - ReturnValues["invokeNewWithNonConstructor"] = "Success"; + ReturnValues["invokeConstructorWithNonConstructor"] = "Success"; } catch (Exception ex) { - ReturnValues["invokeNewWithNonConstructor"] = $"Failure: {ex.Message}"; + ReturnValues["invokeConstructorWithNonConstructor"] = $"Failure: {ex.Message}"; } } private async Task FunctionReferenceAsyncTests() { var funcRef = await JSRuntime.GetValueAsync("jsInteropTests.nonConstructorFunction"); - var testClassRef = await JSRuntime.InvokeNewAsync("jsInteropTests.TestClass", "abraka"); + var testClassRef = await JSRuntime.InvokeConstructorAsync("jsInteropTests.TestClass", "abraka"); await testClassRef.SetValueAsync("getTextLength", funcRef); ReturnValues["changeFunctionViaObjectReferenceAsync"] = (await testClassRef.InvokeAsync("getTextLength")).ToString(); } @@ -621,7 +621,7 @@ var inProcRuntime = ((IJSInProcessRuntime)JSRuntime); var funcRef = inProcRuntime.GetValue("jsInteropTests.nonConstructorFunction"); - var testClassRef = inProcRuntime.InvokeNew("jsInteropTests.TestClass", "abraka"); + var testClassRef = inProcRuntime.InvokeConstructor("jsInteropTests.TestClass", "abraka"); testClassRef.SetValue("getTextLength", funcRef); ReturnValues["changeFunctionViaObjectReference"] = testClassRef.Invoke("getTextLength").ToString(); } diff --git a/src/JSInterop/Microsoft.JSInterop.JS/src/src/Microsoft.JSInterop.ts b/src/JSInterop/Microsoft.JSInterop.JS/src/src/Microsoft.JSInterop.ts index fdd7a4ed65ec..c7c10cacfef1 100644 --- a/src/JSInterop/Microsoft.JSInterop.JS/src/src/Microsoft.JSInterop.ts +++ b/src/JSInterop/Microsoft.JSInterop.JS/src/src/Microsoft.JSInterop.ts @@ -66,7 +66,7 @@ export module DotNet { */ export enum JSCallType { FunctionCall = 1, - NewCall = 2, + ConstructorCall = 2, GetValue = 3, SetValue = 4 } @@ -573,7 +573,7 @@ export module DotNet { } /** Traverses the object hierarchy to find an object member specified by the identifier. - * + * * @param obj Root object to search in. * @param identifier Complete identifier of the member to find, e.g. "document.location.href". * @returns A tuple containing the immediate parent of the member and the member name. @@ -586,19 +586,19 @@ export module DotNet { // Error handling in case of undefined last key depends on the type of operation. for (let i = 0; i < keys.length - 1; i++) { const key = keys[i]; - + if (current && typeof current === 'object' && key in current) { current = current[key]; } else { throw new Error(`Could not find '${identifier}' ('${key}' was undefined).`); } } - + return [current, keys[keys.length - 1]]; } /** Takes an object member and a call type and returns a function that performs the operation specified by the call type on the member. - * + * * @param parent Immediate parent of the accessed object member. * @param memberName Name (key) of the accessed member. * @param callType The type of the operation to perform on the member. @@ -614,7 +614,7 @@ export module DotNet { } else { throw new Error(`The value '${identifier}' is not a function.`); } - case JSCallType.NewCall: + case JSCallType.ConstructorCall: const ctor = parent[memberName]; if (ctor instanceof Function) { const bound = ctor.bind(parent); @@ -640,50 +640,50 @@ export module DotNet { if (!(propName in obj)) { return false; } - + // If the property is present we examine its descriptor, potentially needing to walk up the prototype chain. while (obj !== undefined) { const descriptor = Object.getOwnPropertyDescriptor(obj, propName); - + if (descriptor) { // Return true for data property if (descriptor.hasOwnProperty('value')) { return true } - + // Return true for accessor property with defined getter. return descriptor.hasOwnProperty('get') && typeof descriptor.get === 'function'; } - + obj = Object.getPrototypeOf(obj); } - + return false; } - + function isWritableProperty(obj: any, propName: string) { // Return true for missing property if the property can be added. if (!(propName in obj)) { return Object.isExtensible(obj); } - + // If the property is present we examine its descriptor, potentially needing to walk up the prototype chain. while (obj !== undefined) { const descriptor = Object.getOwnPropertyDescriptor(obj, propName); - + if (descriptor) { // Return true for writable data property. if (descriptor.hasOwnProperty('value') && descriptor.writable) { return true; } - + // Return true for accessor property with defined setter. return descriptor.hasOwnProperty('set') && typeof descriptor.set === 'function'; } - + obj = Object.getPrototypeOf(obj); } - + return false; } diff --git a/src/JSInterop/Microsoft.JSInterop.JS/src/test/CallDispatcher.test.ts b/src/JSInterop/Microsoft.JSInterop.JS/src/test/CallDispatcher.test.ts index 38ee0cc07996..e5b250e41665 100644 --- a/src/JSInterop/Microsoft.JSInterop.JS/src/test/CallDispatcher.test.ts +++ b/src/JSInterop/Microsoft.JSInterop.JS/src/test/CallDispatcher.test.ts @@ -104,7 +104,7 @@ describe("CallDispatcher", () => { )).toThrowError("Test error"); }); - test("NewCall: Constructor function is invoked and returns reference to new object", () => { + test("ConstructorCall: Constructor function is invoked and returns reference to new object", () => { window["testCtor"] = function () { this.a = 10; }; const result = dispatcher.invokeJSFromDotNet( @@ -112,13 +112,13 @@ describe("CallDispatcher", () => { "[]", DotNet.JSCallResultType.JSObjectReference, 0, - DotNet.JSCallType.NewCall + DotNet.JSCallType.ConstructorCall ); expect(result).toMatch("__jsObjectId"); }); - test("NewCall: Class constructor is invoked and returns reference to the new instance", () => { + test("ConstructorCall: Class constructor is invoked and returns reference to the new instance", () => { const TestClass = class { a: number; constructor() { this.a = 10; } @@ -130,7 +130,7 @@ describe("CallDispatcher", () => { "[]", DotNet.JSCallResultType.JSObjectReference, objectId, - DotNet.JSCallType.NewCall + DotNet.JSCallType.ConstructorCall ); expect(result).toMatch("__jsObjectId"); @@ -343,7 +343,7 @@ describe("CallDispatcher", () => { expect(result).toBe("30"); }); - test("NewCall + GetValue: Class constructor is invoked and the new instance value is retrieved", () => { + test("ConstructorCall + GetValue: Class constructor is invoked and the new instance value is retrieved", () => { const TestClass = class { a: number; constructor() { this.a = 20; } @@ -355,7 +355,7 @@ describe("CallDispatcher", () => { "[]", DotNet.JSCallResultType.JSObjectReference, objectId, - DotNet.JSCallType.NewCall + DotNet.JSCallType.ConstructorCall ); const newObjectId = JSON.parse(result ?? "")[jsObjectId]; @@ -370,7 +370,7 @@ describe("CallDispatcher", () => { expect(result2).toBe("20"); }); - test("NewCall + FunctionCall: Class constructor is invoked and method is invoked on the new instance", () => { + test("ConstructorCall + FunctionCall: Class constructor is invoked and method is invoked on the new instance", () => { const TestClass = class { f() { return 30; } }; @@ -381,7 +381,7 @@ describe("CallDispatcher", () => { "[]", DotNet.JSCallResultType.JSObjectReference, objectId, - DotNet.JSCallType.NewCall + DotNet.JSCallType.ConstructorCall ); const newObjectId = JSON.parse(result ?? "")[jsObjectId]; @@ -395,4 +395,4 @@ describe("CallDispatcher", () => { expect(result2).toBe("30"); }); -}); \ No newline at end of file +}); diff --git a/src/JSInterop/Microsoft.JSInterop/src/IJSInProcessObjectReference.cs b/src/JSInterop/Microsoft.JSInterop/src/IJSInProcessObjectReference.cs index d9813f0ddcd0..e399c3822ac5 100644 --- a/src/JSInterop/Microsoft.JSInterop/src/IJSInProcessObjectReference.cs +++ b/src/JSInterop/Microsoft.JSInterop/src/IJSInProcessObjectReference.cs @@ -28,7 +28,7 @@ public interface IJSInProcessObjectReference : IJSObjectReference, IDisposable /// JSON-serializable arguments. /// An instance that represents the created JS object. [RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed.")] - IJSInProcessObjectReference InvokeNew(string identifier, object?[]? args) + IJSInProcessObjectReference InvokeConstructor(string identifier, object?[]? args) => throw new NotImplementedException(); /// diff --git a/src/JSInterop/Microsoft.JSInterop/src/IJSInProcessRuntime.cs b/src/JSInterop/Microsoft.JSInterop/src/IJSInProcessRuntime.cs index cf3954ce0269..79e01ea15ccb 100644 --- a/src/JSInterop/Microsoft.JSInterop/src/IJSInProcessRuntime.cs +++ b/src/JSInterop/Microsoft.JSInterop/src/IJSInProcessRuntime.cs @@ -28,7 +28,7 @@ public interface IJSInProcessRuntime : IJSRuntime /// JSON-serializable arguments. /// An instance that represents the created JS object. [RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed.")] - IJSInProcessObjectReference InvokeNew(string identifier, params object?[]? args) + IJSInProcessObjectReference InvokeConstructor(string identifier, params object?[]? args) => throw new NotImplementedException(); /// diff --git a/src/JSInterop/Microsoft.JSInterop/src/IJSObjectReference.cs b/src/JSInterop/Microsoft.JSInterop/src/IJSObjectReference.cs index cb8cc03329d1..628f587bde15 100644 --- a/src/JSInterop/Microsoft.JSInterop/src/IJSObjectReference.cs +++ b/src/JSInterop/Microsoft.JSInterop/src/IJSObjectReference.cs @@ -43,7 +43,7 @@ public interface IJSObjectReference : IAsyncDisposable /// An identifier for the constructor function to invoke. For example, the value "someScope.SomeClass" will invoke the constructor someScope.SomeClass on the target instance. /// JSON-serializable arguments. /// An instance that represents the created JS object. - ValueTask InvokeNewAsync(string identifier, object?[]? args) + ValueTask InvokeConstructorAsync(string identifier, object?[]? args) => throw new NotImplementedException(); /// @@ -56,7 +56,7 @@ ValueTask InvokeNewAsync(string identifier, object?[]? args) /// /// JSON-serializable arguments. /// An instance that represents the created JS object. - ValueTask InvokeNewAsync(string identifier, CancellationToken cancellationToken, object?[]? args) + ValueTask InvokeConstructorAsync(string identifier, CancellationToken cancellationToken, object?[]? args) => throw new NotImplementedException(); /// diff --git a/src/JSInterop/Microsoft.JSInterop/src/IJSRuntime.cs b/src/JSInterop/Microsoft.JSInterop/src/IJSRuntime.cs index b897245c0da0..2e9329af3eac 100644 --- a/src/JSInterop/Microsoft.JSInterop/src/IJSRuntime.cs +++ b/src/JSInterop/Microsoft.JSInterop/src/IJSRuntime.cs @@ -43,7 +43,7 @@ public interface IJSRuntime /// An identifier for the constructor function to invoke. For example, the value "someScope.SomeClass" will invoke the constructor window.someScope.SomeClass. /// JSON-serializable arguments. /// An instance that represents the created JS object. - ValueTask InvokeNewAsync(string identifier, object?[]? args) + ValueTask InvokeConstructorAsync(string identifier, object?[]? args) => throw new NotImplementedException(); /// @@ -56,7 +56,7 @@ ValueTask InvokeNewAsync(string identifier, object?[]? args) /// /// JSON-serializable arguments. /// An instance that represents the created JS object. - ValueTask InvokeNewAsync(string identifier, CancellationToken cancellationToken, object?[]? args) + ValueTask InvokeConstructorAsync(string identifier, CancellationToken cancellationToken, object?[]? args) => throw new NotImplementedException(); /// diff --git a/src/JSInterop/Microsoft.JSInterop/src/Implementation/JSInProcessObjectReference.cs b/src/JSInterop/Microsoft.JSInterop/src/Implementation/JSInProcessObjectReference.cs index abe9472251cc..a52749d0dd67 100644 --- a/src/JSInterop/Microsoft.JSInterop/src/Implementation/JSInProcessObjectReference.cs +++ b/src/JSInterop/Microsoft.JSInterop/src/Implementation/JSInProcessObjectReference.cs @@ -36,11 +36,11 @@ protected internal JSInProcessObjectReference(JSInProcessRuntime jsRuntime, long /// [RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed.")] - public IJSInProcessObjectReference InvokeNew(string identifier, object?[]? args) + public IJSInProcessObjectReference InvokeConstructor(string identifier, object?[]? args) { ThrowIfDisposed(); - return _jsRuntime.Invoke(identifier, Id, JSCallType.NewCall, args); + return _jsRuntime.Invoke(identifier, Id, JSCallType.ConstructorCall, args); } /// diff --git a/src/JSInterop/Microsoft.JSInterop/src/Implementation/JSObjectReference.cs b/src/JSInterop/Microsoft.JSInterop/src/Implementation/JSObjectReference.cs index f1479cf50730..21b3420b8f78 100644 --- a/src/JSInterop/Microsoft.JSInterop/src/Implementation/JSObjectReference.cs +++ b/src/JSInterop/Microsoft.JSInterop/src/Implementation/JSObjectReference.cs @@ -50,19 +50,19 @@ protected internal JSObjectReference(JSRuntime jsRuntime, long id) } /// - public ValueTask InvokeNewAsync(string identifier, object?[]? args) + public ValueTask InvokeConstructorAsync(string identifier, object?[]? args) { ThrowIfDisposed(); - return _jsRuntime.InvokeAsync(Id, identifier, JSCallType.NewCall, args); + return _jsRuntime.InvokeAsync(Id, identifier, JSCallType.ConstructorCall, args); } /// - public ValueTask InvokeNewAsync(string identifier, CancellationToken cancellationToken, object?[]? args) + public ValueTask InvokeConstructorAsync(string identifier, CancellationToken cancellationToken, object?[]? args) { ThrowIfDisposed(); - return _jsRuntime.InvokeAsync(Id, identifier, JSCallType.NewCall, cancellationToken, args); + return _jsRuntime.InvokeAsync(Id, identifier, JSCallType.ConstructorCall, cancellationToken, args); } /// @@ -78,7 +78,7 @@ public ValueTask InvokeNewAsync(string identifier, Cancellat { ThrowIfDisposed(); - return _jsRuntime.InvokeAsync(Id, identifier, JSCallType.GetValue, null); + return _jsRuntime.InvokeAsync(Id, identifier, JSCallType.GetValue, cancellationToken, null); } /// @@ -94,7 +94,7 @@ public ValueTask InvokeNewAsync(string identifier, Cancellat { ThrowIfDisposed(); - await _jsRuntime.InvokeAsync(Id, identifier, JSCallType.SetValue, [value]); + await _jsRuntime.InvokeAsync(Id, identifier, JSCallType.SetValue, cancellationToken, [value]); } /// diff --git a/src/JSInterop/Microsoft.JSInterop/src/Infrastructure/JSCallType.cs b/src/JSInterop/Microsoft.JSInterop/src/Infrastructure/JSCallType.cs index a217a800f159..1ab9dbb0fe08 100644 --- a/src/JSInterop/Microsoft.JSInterop/src/Infrastructure/JSCallType.cs +++ b/src/JSInterop/Microsoft.JSInterop/src/Infrastructure/JSCallType.cs @@ -16,7 +16,7 @@ public enum JSCallType : int /// /// Represents a constructor function invocation with the new operator. /// - NewCall = 2, + ConstructorCall = 2, /// /// Represents reading a property value. diff --git a/src/JSInterop/Microsoft.JSInterop/src/JSInProcessRuntime.cs b/src/JSInterop/Microsoft.JSInterop/src/JSInProcessRuntime.cs index 2bcc5fa729b9..280c57003066 100644 --- a/src/JSInterop/Microsoft.JSInterop/src/JSInProcessRuntime.cs +++ b/src/JSInterop/Microsoft.JSInterop/src/JSInProcessRuntime.cs @@ -28,8 +28,8 @@ public abstract class JSInProcessRuntime : JSRuntime, IJSInProcessRuntime /// [RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed.")] - public IJSInProcessObjectReference InvokeNew(string identifier, params object?[]? args) - => Invoke(identifier, WindowObjectId, JSCallType.NewCall, args); + public IJSInProcessObjectReference InvokeConstructor(string identifier, params object?[]? args) + => Invoke(identifier, WindowObjectId, JSCallType.ConstructorCall, args); /// [RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed.")] diff --git a/src/JSInterop/Microsoft.JSInterop/src/JSObjectReferenceExtensions.cs b/src/JSInterop/Microsoft.JSInterop/src/JSObjectReferenceExtensions.cs index 4ddcc358ef2f..06d476c74081 100644 --- a/src/JSInterop/Microsoft.JSInterop/src/JSObjectReferenceExtensions.cs +++ b/src/JSInterop/Microsoft.JSInterop/src/JSObjectReferenceExtensions.cs @@ -125,11 +125,11 @@ public static async ValueTask InvokeVoidAsync(this IJSObjectReference jsObjectRe /// An identifier for the constructor function to invoke. For example, the value "someScope.SomeClass" will invoke the constructor someScope.SomeClass. /// JSON-serializable arguments. /// An instance that represents the created JS object. - public static ValueTask InvokeNewAsync(this IJSObjectReference jsObjectReference, string identifier, params object?[]? args) + public static ValueTask InvokeConstructorAsync(this IJSObjectReference jsObjectReference, string identifier, params object?[]? args) { ArgumentNullException.ThrowIfNull(jsObjectReference); - return jsObjectReference.InvokeNewAsync(identifier, args); + return jsObjectReference.InvokeConstructorAsync(identifier, args); } /// @@ -143,11 +143,11 @@ public static ValueTask InvokeNewAsync(this IJSObjectReferen /// /// JSON-serializable arguments. /// An instance that represents the created JS object. - public static ValueTask InvokeNewAsync(this IJSObjectReference jsObjectReference, string identifier, CancellationToken cancellationToken, object?[]? args) + public static ValueTask InvokeConstructorAsync(this IJSObjectReference jsObjectReference, string identifier, CancellationToken cancellationToken, object?[]? args) { ArgumentNullException.ThrowIfNull(jsObjectReference); - return jsObjectReference.InvokeNewAsync(identifier, cancellationToken, args); + return jsObjectReference.InvokeConstructorAsync(identifier, cancellationToken, args); } /// @@ -158,13 +158,50 @@ public static ValueTask InvokeNewAsync(this IJSObjectReferen /// The duration after which to cancel the async operation. Overrides default timeouts (). /// JSON-serializable arguments. /// An instance that represents the created JS object. - public static ValueTask InvokeNewAsync(this IJSObjectReference jsObjectReference, string identifier, TimeSpan timeout, object?[]? args) + public static ValueTask InvokeConstructorAsync(this IJSObjectReference jsObjectReference, string identifier, TimeSpan timeout, object?[]? args) { ArgumentNullException.ThrowIfNull(jsObjectReference); using var cancellationTokenSource = timeout == Timeout.InfiniteTimeSpan ? null : new CancellationTokenSource(timeout); var cancellationToken = cancellationTokenSource?.Token ?? CancellationToken.None; - return jsObjectReference.InvokeNewAsync(identifier, cancellationToken, args); + return jsObjectReference.InvokeConstructorAsync(identifier, cancellationToken, args); + } + + /// + /// Reads the value of the specified JavaScript property asynchronously. + /// + /// The JSON-serializable return type. + /// The . + /// An identifier for the property to read. For example, the value "someScope.someProp" will read the value of the property someScope.someProp. + /// The duration after which to cancel the async operation. Overrides default timeouts (). + /// An instance of obtained by JSON-deserializing the return value. + public static ValueTask GetValueAsync<[DynamicallyAccessedMembers(JsonSerialized)] TValue>(this IJSObjectReference jsObjectReference, string identifier, TimeSpan timeout) + { + ArgumentNullException.ThrowIfNull(jsObjectReference); + + using var cancellationTokenSource = timeout == Timeout.InfiniteTimeSpan ? null : new CancellationTokenSource(timeout); + var cancellationToken = cancellationTokenSource?.Token ?? CancellationToken.None; + + return jsObjectReference.GetValueAsync(identifier, cancellationToken); + } + + /// + /// Updates the value of the specified JavaScript property asynchronously. If the property is not defined on the target object, it will be created. + /// + /// JSON-serializable argument type. + /// The . + /// An identifier for the property to set. For example, the value "someScope.someProp" will update the property someScope.someProp. + /// JSON-serializable value. + /// The duration after which to cancel the async operation. Overrides default timeouts (). + /// A that represents the asynchronous invocation operation. + public static ValueTask SetValueAsync<[DynamicallyAccessedMembers(JsonSerialized)] TValue>(this IJSObjectReference jsObjectReference, string identifier, TValue value, TimeSpan timeout) + { + ArgumentNullException.ThrowIfNull(jsObjectReference); + + using var cancellationTokenSource = timeout == Timeout.InfiniteTimeSpan ? null : new CancellationTokenSource(timeout); + var cancellationToken = cancellationTokenSource?.Token ?? CancellationToken.None; + + return jsObjectReference.SetValueAsync(identifier, value, cancellationToken); } } diff --git a/src/JSInterop/Microsoft.JSInterop/src/JSRuntime.cs b/src/JSInterop/Microsoft.JSInterop/src/JSRuntime.cs index f91746f99f50..53400106f4d1 100644 --- a/src/JSInterop/Microsoft.JSInterop/src/JSRuntime.cs +++ b/src/JSInterop/Microsoft.JSInterop/src/JSRuntime.cs @@ -85,12 +85,12 @@ protected JSRuntime() => InvokeAsync(WindowObjectId, identifier, JSCallType.FunctionCall, cancellationToken, args); /// - public ValueTask InvokeNewAsync(string identifier, object?[]? args) - => InvokeAsync(WindowObjectId, identifier, JSCallType.NewCall, args); + public ValueTask InvokeConstructorAsync(string identifier, object?[]? args) + => InvokeAsync(WindowObjectId, identifier, JSCallType.ConstructorCall, args); /// - public ValueTask InvokeNewAsync(string identifier, CancellationToken cancellationToken, object?[]? args) - => InvokeAsync(WindowObjectId, identifier, JSCallType.NewCall, cancellationToken, args); + public ValueTask InvokeConstructorAsync(string identifier, CancellationToken cancellationToken, object?[]? args) + => InvokeAsync(WindowObjectId, identifier, JSCallType.ConstructorCall, cancellationToken, args); /// public ValueTask GetValueAsync<[DynamicallyAccessedMembers(JsonSerialized)] TValue>(string identifier) diff --git a/src/JSInterop/Microsoft.JSInterop/src/JSRuntimeExtensions.cs b/src/JSInterop/Microsoft.JSInterop/src/JSRuntimeExtensions.cs index aa05aa681cad..8a8cf34313ac 100644 --- a/src/JSInterop/Microsoft.JSInterop/src/JSRuntimeExtensions.cs +++ b/src/JSInterop/Microsoft.JSInterop/src/JSRuntimeExtensions.cs @@ -125,11 +125,11 @@ public static async ValueTask InvokeVoidAsync(this IJSRuntime jsRuntime, string /// An identifier for the constructor function to invoke. For example, the value "someScope.SomeClass" will invoke the constructor window.someScope.SomeClass. /// JSON-serializable arguments. /// An instance that represents the created JS object. - public static ValueTask InvokeNewAsync(this IJSRuntime jsRuntime, string identifier, params object?[]? args) + public static ValueTask InvokeConstructorAsync(this IJSRuntime jsRuntime, string identifier, params object?[]? args) { ArgumentNullException.ThrowIfNull(jsRuntime); - return jsRuntime.InvokeNewAsync(identifier, args); + return jsRuntime.InvokeConstructorAsync(identifier, args); } /// @@ -143,11 +143,11 @@ public static ValueTask InvokeNewAsync(this IJSRuntime jsRun /// /// JSON-serializable arguments. /// An instance that represents the created JS object. - public static ValueTask InvokeNewAsync(this IJSRuntime jsRuntime, string identifier, CancellationToken cancellationToken, object?[]? args) + public static ValueTask InvokeConstructorAsync(this IJSRuntime jsRuntime, string identifier, CancellationToken cancellationToken, object?[]? args) { ArgumentNullException.ThrowIfNull(jsRuntime); - return jsRuntime.InvokeNewAsync(identifier, cancellationToken, args); + return jsRuntime.InvokeConstructorAsync(identifier, cancellationToken, args); } /// @@ -158,13 +158,50 @@ public static ValueTask InvokeNewAsync(this IJSRuntime jsRun /// The duration after which to cancel the async operation. Overrides default timeouts (). /// JSON-serializable arguments. /// An instance that represents the created JS object. - public static ValueTask InvokeNewAsync(this IJSRuntime jsRuntime, string identifier, TimeSpan timeout, object?[]? args) + public static ValueTask InvokeConstructorAsync(this IJSRuntime jsRuntime, string identifier, TimeSpan timeout, object?[]? args) { ArgumentNullException.ThrowIfNull(jsRuntime); using var cancellationTokenSource = timeout == Timeout.InfiniteTimeSpan ? null : new CancellationTokenSource(timeout); var cancellationToken = cancellationTokenSource?.Token ?? CancellationToken.None; - return jsRuntime.InvokeNewAsync(identifier, cancellationToken, args); + return jsRuntime.InvokeConstructorAsync(identifier, cancellationToken, args); + } + + /// + /// Reads the value of the specified JavaScript property asynchronously. + /// + /// The JSON-serializable return type. + /// The . + /// An identifier for the property to read. For example, the value "someScope.someProp" will read the value of the property window.someScope.someProp. + /// The duration after which to cancel the async operation. Overrides default timeouts (). + /// An instance of obtained by JSON-deserializing the return value. + public static ValueTask GetValueAsync<[DynamicallyAccessedMembers(JsonSerialized)] TValue>(this IJSRuntime jsRuntime, string identifier, TimeSpan timeout) + { + ArgumentNullException.ThrowIfNull(jsRuntime); + + using var cancellationTokenSource = timeout == Timeout.InfiniteTimeSpan ? null : new CancellationTokenSource(timeout); + var cancellationToken = cancellationTokenSource?.Token ?? CancellationToken.None; + + return jsRuntime.GetValueAsync(identifier, cancellationToken); + } + + /// + /// Updates the value of the specified JavaScript property asynchronously. If the property is not defined on the target object, it will be created. + /// + /// JSON-serializable argument type. + /// The . + /// An identifier for the property to set. For example, the value "someScope.someProp" will update the property window.someScope.someProp. + /// JSON-serializable value. + /// The duration after which to cancel the async operation. Overrides default timeouts (). + /// A that represents the asynchronous invocation operation. + public static ValueTask SetValueAsync<[DynamicallyAccessedMembers(JsonSerialized)] TValue>(this IJSRuntime jsRuntime, string identifier, TValue value, TimeSpan timeout) + { + ArgumentNullException.ThrowIfNull(jsRuntime); + + using var cancellationTokenSource = timeout == Timeout.InfiniteTimeSpan ? null : new CancellationTokenSource(timeout); + var cancellationToken = cancellationTokenSource?.Token ?? CancellationToken.None; + + return jsRuntime.SetValueAsync(identifier, value, cancellationToken); } } diff --git a/src/JSInterop/Microsoft.JSInterop/src/PublicAPI.Unshipped.txt b/src/JSInterop/Microsoft.JSInterop/src/PublicAPI.Unshipped.txt index b6c32d826997..cbcf93893832 100644 --- a/src/JSInterop/Microsoft.JSInterop/src/PublicAPI.Unshipped.txt +++ b/src/JSInterop/Microsoft.JSInterop/src/PublicAPI.Unshipped.txt @@ -1,35 +1,35 @@ #nullable enable Microsoft.JSInterop.IJSInProcessObjectReference.GetValue(string! identifier) -> TValue -Microsoft.JSInterop.IJSInProcessObjectReference.InvokeNew(string! identifier, object?[]? args) -> Microsoft.JSInterop.IJSInProcessObjectReference! +Microsoft.JSInterop.IJSInProcessObjectReference.InvokeConstructor(string! identifier, object?[]? args) -> Microsoft.JSInterop.IJSInProcessObjectReference! Microsoft.JSInterop.IJSInProcessObjectReference.SetValue(string! identifier, TValue value) -> void Microsoft.JSInterop.IJSInProcessRuntime.GetValue(string! identifier) -> TValue -Microsoft.JSInterop.IJSInProcessRuntime.InvokeNew(string! identifier, params object?[]? args) -> Microsoft.JSInterop.IJSInProcessObjectReference! +Microsoft.JSInterop.IJSInProcessRuntime.InvokeConstructor(string! identifier, params object?[]? args) -> Microsoft.JSInterop.IJSInProcessObjectReference! Microsoft.JSInterop.IJSInProcessRuntime.SetValue(string! identifier, TValue value) -> void Microsoft.JSInterop.IJSObjectReference.GetValueAsync(string! identifier) -> System.Threading.Tasks.ValueTask Microsoft.JSInterop.IJSObjectReference.GetValueAsync(string! identifier, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask -Microsoft.JSInterop.IJSObjectReference.InvokeNewAsync(string! identifier, object?[]? args) -> System.Threading.Tasks.ValueTask -Microsoft.JSInterop.IJSObjectReference.InvokeNewAsync(string! identifier, System.Threading.CancellationToken cancellationToken, object?[]? args) -> System.Threading.Tasks.ValueTask +Microsoft.JSInterop.IJSObjectReference.InvokeConstructorAsync(string! identifier, object?[]? args) -> System.Threading.Tasks.ValueTask +Microsoft.JSInterop.IJSObjectReference.InvokeConstructorAsync(string! identifier, System.Threading.CancellationToken cancellationToken, object?[]? args) -> System.Threading.Tasks.ValueTask Microsoft.JSInterop.IJSObjectReference.SetValueAsync(string! identifier, TValue value) -> System.Threading.Tasks.ValueTask Microsoft.JSInterop.IJSObjectReference.SetValueAsync(string! identifier, TValue value, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask Microsoft.JSInterop.IJSRuntime.GetValueAsync(string! identifier) -> System.Threading.Tasks.ValueTask Microsoft.JSInterop.IJSRuntime.GetValueAsync(string! identifier, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask -Microsoft.JSInterop.IJSRuntime.InvokeNewAsync(string! identifier, object?[]? args) -> System.Threading.Tasks.ValueTask -Microsoft.JSInterop.IJSRuntime.InvokeNewAsync(string! identifier, System.Threading.CancellationToken cancellationToken, object?[]? args) -> System.Threading.Tasks.ValueTask +Microsoft.JSInterop.IJSRuntime.InvokeConstructorAsync(string! identifier, object?[]? args) -> System.Threading.Tasks.ValueTask +Microsoft.JSInterop.IJSRuntime.InvokeConstructorAsync(string! identifier, System.Threading.CancellationToken cancellationToken, object?[]? args) -> System.Threading.Tasks.ValueTask Microsoft.JSInterop.IJSRuntime.SetValueAsync(string! identifier, TValue value) -> System.Threading.Tasks.ValueTask Microsoft.JSInterop.IJSRuntime.SetValueAsync(string! identifier, TValue value, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask Microsoft.JSInterop.Implementation.JSInProcessObjectReference.GetValue(string! identifier) -> TValue -Microsoft.JSInterop.Implementation.JSInProcessObjectReference.InvokeNew(string! identifier, object?[]? args) -> Microsoft.JSInterop.IJSInProcessObjectReference! +Microsoft.JSInterop.Implementation.JSInProcessObjectReference.InvokeConstructor(string! identifier, object?[]? args) -> Microsoft.JSInterop.IJSInProcessObjectReference! Microsoft.JSInterop.Implementation.JSInProcessObjectReference.SetValue(string! identifier, TValue value) -> void Microsoft.JSInterop.Implementation.JSObjectReference.GetValueAsync(string! identifier) -> System.Threading.Tasks.ValueTask Microsoft.JSInterop.Implementation.JSObjectReference.GetValueAsync(string! identifier, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask -Microsoft.JSInterop.Implementation.JSObjectReference.InvokeNewAsync(string! identifier, object?[]? args) -> System.Threading.Tasks.ValueTask -Microsoft.JSInterop.Implementation.JSObjectReference.InvokeNewAsync(string! identifier, System.Threading.CancellationToken cancellationToken, object?[]? args) -> System.Threading.Tasks.ValueTask +Microsoft.JSInterop.Implementation.JSObjectReference.InvokeConstructorAsync(string! identifier, object?[]? args) -> System.Threading.Tasks.ValueTask +Microsoft.JSInterop.Implementation.JSObjectReference.InvokeConstructorAsync(string! identifier, System.Threading.CancellationToken cancellationToken, object?[]? args) -> System.Threading.Tasks.ValueTask Microsoft.JSInterop.Implementation.JSObjectReference.SetValueAsync(string! identifier, TValue value) -> System.Threading.Tasks.ValueTask Microsoft.JSInterop.Implementation.JSObjectReference.SetValueAsync(string! identifier, TValue value, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask Microsoft.JSInterop.Infrastructure.JSCallType Microsoft.JSInterop.Infrastructure.JSCallType.FunctionCall = 1 -> Microsoft.JSInterop.Infrastructure.JSCallType Microsoft.JSInterop.Infrastructure.JSCallType.GetValue = 3 -> Microsoft.JSInterop.Infrastructure.JSCallType -Microsoft.JSInterop.Infrastructure.JSCallType.NewCall = 2 -> Microsoft.JSInterop.Infrastructure.JSCallType +Microsoft.JSInterop.Infrastructure.JSCallType.ConstructorCall = 2 -> Microsoft.JSInterop.Infrastructure.JSCallType Microsoft.JSInterop.Infrastructure.JSCallType.SetValue = 4 -> Microsoft.JSInterop.Infrastructure.JSCallType Microsoft.JSInterop.Infrastructure.JSInvocationInfo Microsoft.JSInterop.Infrastructure.JSInvocationInfo.ArgsJson.get -> string! @@ -46,19 +46,23 @@ Microsoft.JSInterop.Infrastructure.JSInvocationInfo.ResultType.init -> void Microsoft.JSInterop.Infrastructure.JSInvocationInfo.TargetInstanceId.get -> long Microsoft.JSInterop.Infrastructure.JSInvocationInfo.TargetInstanceId.init -> void Microsoft.JSInterop.JSInProcessRuntime.GetValue(string! identifier) -> TValue -Microsoft.JSInterop.JSInProcessRuntime.InvokeNew(string! identifier, params object?[]? args) -> Microsoft.JSInterop.IJSInProcessObjectReference! +Microsoft.JSInterop.JSInProcessRuntime.InvokeConstructor(string! identifier, params object?[]? args) -> Microsoft.JSInterop.IJSInProcessObjectReference! Microsoft.JSInterop.JSInProcessRuntime.SetValue(string! identifier, TValue value) -> void Microsoft.JSInterop.JSRuntime.GetValueAsync(string! identifier) -> System.Threading.Tasks.ValueTask Microsoft.JSInterop.JSRuntime.GetValueAsync(string! identifier, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask -Microsoft.JSInterop.JSRuntime.InvokeNewAsync(string! identifier, object?[]? args) -> System.Threading.Tasks.ValueTask -Microsoft.JSInterop.JSRuntime.InvokeNewAsync(string! identifier, System.Threading.CancellationToken cancellationToken, object?[]? args) -> System.Threading.Tasks.ValueTask +Microsoft.JSInterop.JSRuntime.InvokeConstructorAsync(string! identifier, object?[]? args) -> System.Threading.Tasks.ValueTask +Microsoft.JSInterop.JSRuntime.InvokeConstructorAsync(string! identifier, System.Threading.CancellationToken cancellationToken, object?[]? args) -> System.Threading.Tasks.ValueTask Microsoft.JSInterop.JSRuntime.SetValueAsync(string! identifier, TValue value) -> System.Threading.Tasks.ValueTask Microsoft.JSInterop.JSRuntime.SetValueAsync(string! identifier, TValue value, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask -static Microsoft.JSInterop.JSObjectReferenceExtensions.InvokeNewAsync(this Microsoft.JSInterop.IJSObjectReference! jsObjectReference, string! identifier, params object?[]? args) -> System.Threading.Tasks.ValueTask -static Microsoft.JSInterop.JSObjectReferenceExtensions.InvokeNewAsync(this Microsoft.JSInterop.IJSObjectReference! jsObjectReference, string! identifier, System.Threading.CancellationToken cancellationToken, object?[]? args) -> System.Threading.Tasks.ValueTask -static Microsoft.JSInterop.JSObjectReferenceExtensions.InvokeNewAsync(this Microsoft.JSInterop.IJSObjectReference! jsObjectReference, string! identifier, System.TimeSpan timeout, object?[]? args) -> System.Threading.Tasks.ValueTask -static Microsoft.JSInterop.JSRuntimeExtensions.InvokeNewAsync(this Microsoft.JSInterop.IJSRuntime! jsRuntime, string! identifier, params object?[]? args) -> System.Threading.Tasks.ValueTask -static Microsoft.JSInterop.JSRuntimeExtensions.InvokeNewAsync(this Microsoft.JSInterop.IJSRuntime! jsRuntime, string! identifier, System.Threading.CancellationToken cancellationToken, object?[]? args) -> System.Threading.Tasks.ValueTask -static Microsoft.JSInterop.JSRuntimeExtensions.InvokeNewAsync(this Microsoft.JSInterop.IJSRuntime! jsRuntime, string! identifier, System.TimeSpan timeout, object?[]? args) -> System.Threading.Tasks.ValueTask +static Microsoft.JSInterop.JSObjectReferenceExtensions.InvokeConstructorAsync(this Microsoft.JSInterop.IJSObjectReference! jsObjectReference, string! identifier, params object?[]? args) -> System.Threading.Tasks.ValueTask +static Microsoft.JSInterop.JSObjectReferenceExtensions.InvokeConstructorAsync(this Microsoft.JSInterop.IJSObjectReference! jsObjectReference, string! identifier, System.Threading.CancellationToken cancellationToken, object?[]? args) -> System.Threading.Tasks.ValueTask +static Microsoft.JSInterop.JSObjectReferenceExtensions.InvokeConstructorAsync(this Microsoft.JSInterop.IJSObjectReference! jsObjectReference, string! identifier, System.TimeSpan timeout, object?[]? args) -> System.Threading.Tasks.ValueTask +static Microsoft.JSInterop.JSObjectReferenceExtensions.GetValueAsync(this Microsoft.JSInterop.IJSObjectReference! jsObjectReference, string! identifier, System.TimeSpan timeout) -> System.Threading.Tasks.ValueTask +static Microsoft.JSInterop.JSObjectReferenceExtensions.SetValueAsync(this Microsoft.JSInterop.IJSObjectReference! jsObjectReference, string! identifier, TValue value, System.TimeSpan timeout) -> System.Threading.Tasks.ValueTask +static Microsoft.JSInterop.JSRuntimeExtensions.InvokeConstructorAsync(this Microsoft.JSInterop.IJSRuntime! jsRuntime, string! identifier, params object?[]? args) -> System.Threading.Tasks.ValueTask +static Microsoft.JSInterop.JSRuntimeExtensions.InvokeConstructorAsync(this Microsoft.JSInterop.IJSRuntime! jsRuntime, string! identifier, System.Threading.CancellationToken cancellationToken, object?[]? args) -> System.Threading.Tasks.ValueTask +static Microsoft.JSInterop.JSRuntimeExtensions.InvokeConstructorAsync(this Microsoft.JSInterop.IJSRuntime! jsRuntime, string! identifier, System.TimeSpan timeout, object?[]? args) -> System.Threading.Tasks.ValueTask +static Microsoft.JSInterop.JSRuntimeExtensions.GetValueAsync(this Microsoft.JSInterop.IJSRuntime! jsRuntime, string! identifier, System.TimeSpan timeout) -> System.Threading.Tasks.ValueTask +static Microsoft.JSInterop.JSRuntimeExtensions.SetValueAsync(this Microsoft.JSInterop.IJSRuntime! jsRuntime, string! identifier, TValue value, System.TimeSpan timeout) -> System.Threading.Tasks.ValueTask virtual Microsoft.JSInterop.JSInProcessRuntime.InvokeJS(in Microsoft.JSInterop.Infrastructure.JSInvocationInfo invocationInfo) -> string? virtual Microsoft.JSInterop.JSRuntime.BeginInvokeJS(in Microsoft.JSInterop.Infrastructure.JSInvocationInfo invocationInfo) -> void