public async Task AddEventListenerAsync <TEventArg>(string eventName, string elementSelector, Action <TEventArg> eventCallback) { var jsCallback = new JsCallback(arg => eventCallback?.Invoke(arg.As <TEventArg>())); await _jsRuntime.InvokeAsync <object>("dotnetify_blazor.addEventListener", eventName, elementSelector, DotNetObjectReference.Create(jsCallback)); }
public Task AddEventListenerAsync <TEventArg>(string eventName, ElementRef elementRef, Action <TEventArg> eventCallback) { var jsCallback = new JsCallback(arg => eventCallback?.Invoke(arg.As <TEventArg>())); return(_jsRuntime.InvokeAsync <object>("dotnetify_blazor.addEventListener", eventName, elementRef, DotNetObjectRef.Create(jsCallback))); }