void IHandleEvent.HandleEvent(EventHandlerInvoker binding, UIEventArgs args) { var task = binding.Invoke(args); ContinueAfterLifecycleTask(task); // After each event, we synchronously re-render (unless !ShouldRender()) // This just saves the developer the trouble of putting "StateHasChanged();" // at the end of every event callback. StateHasChanged(); }
Task IHandleEvent.HandleEventAsync(EventHandlerInvoker binding, UIEventArgs args) { var task = binding.Invoke(args); var shouldAwaitTask = task.Status != TaskStatus.RanToCompletion && task.Status != TaskStatus.Canceled; // After each event, we synchronously re-render (unless !ShouldRender()) // This just saves the developer the trouble of putting "StateHasChanged();" // at the end of every event callback. StateHasChanged(); return(shouldAwaitTask ? CallStateHasChangedOnAsyncCompletion(task) : Task.CompletedTask); }