/// <summary> /// Fires either the error or the load simple event. Which one is fired /// depends on the state of the provided task. /// </summary> /// <param name="target">The target of the event.</param> /// <param name="task">The task that just finished.</param> public static void FireLoadOrErrorEvent(this EventTarget target, Task task) { if (task.IsFaulted || task.Exception != null) { target.FireSimpleEvent(EventNames.Error); } else { target.FireSimpleEvent(EventNames.Load); } }