You can clone with
When calling back into JS from CLR the JS function has to invoke a passed in callback to the CLR again to continue the CLR code in case of an await on the call to JS. If CLR only wants to fire an event in JS and doesn't need to await the return of the callback the pattern can be simplified.
I wonder if it makes sense to generalize it a bit to supporting Action<object> delegates in addition to Func<object,Task<object>>. Both ways. Thoughts?
for Action<object> mapping to a JS return value of undefined.
For simplifying fire and forget type calls this makes sense as it won't block the main app thread.