Is there an existing issue for this?
Is your feature request related to a problem? Please describe the problem.
I would like to listen to events of a IJSInProcessObjectReference/IJSObjectReference without the need for handcrafting or managing the registration of the javascript EventListener and/or callback.
Describe the solution you'd like
a source generator that allows the creation and/management of event listeners and dotnet callbacks that hook into .NET EventHandler
public event EventHandle<EventTypeArg> EventName;
IJSInProcessRuntime _runtime;
IJSInProcessObjectReference _instanceHandle = _runtime.InvokeConstructor("objectType", ...);
// source generator would detect and generate the c# and javascript interop to create,
// manage and release the _instanceHandle (EventTarget) EventListener including the disposing.
_instanceHandle.Bind("event-name", EventName);
Additional context
It seem logic to have this added to the blazor interop functionality to make use of the same event listern management/tracking system that is used by blazor for components and html elements and given the base javascript EventTarget class is used for both html and non-html element and to provide the event listern bindings/release/dispatch.
Is there an existing issue for this?
Is your feature request related to a problem? Please describe the problem.
I would like to listen to events of a IJSInProcessObjectReference/IJSObjectReference without the need for handcrafting or managing the registration of the javascript EventListener and/or callback.
Describe the solution you'd like
a source generator that allows the creation and/management of event listeners and dotnet callbacks that hook into .NET EventHandler
Additional context
It seem logic to have this added to the blazor interop functionality to make use of the same event listern management/tracking system that is used by blazor for components and html elements and given the base javascript EventTarget class is used for both html and non-html element and to provide the event listern bindings/release/dispatch.