Commit Graph

4 Commits

Author SHA1 Message Date
Pranav K ef2dc5024f Add support for JSInvokable methods on generic types (dotnet/extensions#2342)
* Add support for JSInvokable methods on generic types

Prior to this change, DotNetDispatcher cached the MethodInfo on the
generic type definition. Using this would have required MethodInfo.MakeGenericMethod before the method was invoked.
We could separately cache the result of this to avoid the reflection cost per invocation.

Alternatively we could cache static and non-static MethodInfo instances separately which is what this change attempts to do.
The big difference in the outcome is that this requires instance (non-static) JSInvokable methods to be only unique named within
the type hierarchy as opposed to across all static and instance JSInvokable methods in an assembly.

Fixes https://github.com/aspnet/Extensions/issues/1360
Fixes https://github.com/aspnet/AspNetCore/issues/9061
\n\nCommit migrated from 659b604fb2
2019-09-19 10:48:09 -07:00
Pranav K d46d569b81 Simplify JSRuntime method signature (dotnet/extensions#2188)
\n\nCommit migrated from 9c392a92ef
2019-08-16 16:19:23 -07:00
Pranav K ef83e3359d Change JSInterop to avoid using async locals (dotnet/extensions#2163)
* Remove the use of async local JSRuntime

* Update DotNetDispatcher to accept a JSRuntime instance rather than use a ambient value.
* Modify DotNetObjectReference to start tracking it's value during serialization.
\n\nCommit migrated from ae9878bb99
2019-08-15 17:14:03 -07:00
Pranav K 9372816b7c API Review: JSRuntime (dotnet/extensions#2166)
* API Review: JSRuntime

* Rename JSRuntimeBase -> JSRuntime
* Rename JSInProcessRuntimeBase -> JSInProcessRuntime
* Rename DotNetObjectRef -> DotNetObjectReference
* Update JSRuntime to return ValueTask
* Make InvokeAsync APIs that explicitly cancels and API that default cancels more crisp
* Introduce void invoking APIs
* Fixup method names on DotNetDispatcher

\n\nCommit migrated from 93d3ae4485
2019-08-14 12:24:35 -07:00