Task lifecycle events

ember-concurrency implements a number of lifecycle events that allow for a host object to react to various changes in task instance lifecycle. Using lifecycle hooks allows for adding things like instrumentation to tasks or for separating and reusing error handling code across different tasks. Using the evented modifier will enable tasks to fire lifecycle events on their host objects.

In the below example, we refactor the AJAX throttling example to use task events for logging of the ajaxTask's state changes, instead of doing it manually in the looping task itself.

Live Example

  • Task 0: making AJAX request
  • Task 1: making AJAX request
  • Task 2: making AJAX request