예제 #1
0
 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));
 }
예제 #2
0
        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)));
        }