Previous: Using maxConcurrency
Starting with ember-concurrency v2.2.0, public Task Modifier APIs have been added to allow for custom task modifiers to be registered from third-party addons and application code to provide behavior for specific situations not suited to inclusion within ember-concurrency's core itself.
Task modifiers have been a concept built-in to
ember-concurrency
since the beginning. However, until
0.7.19
they were only specifyable within
ember-concurrency
internals, and not extendable by users.
0.7.19
added the ability to specify new modifiers as prototype extensions on
TaskProperty
. Unfortunately,
TaskProperty
is inherently tied to Ember internals and is not used when using
decorators, and using prototype extensions does not make clear what
modifiers exist, so the
getModifier
,
hasModifier
, and
registerModifier
APIs were introduced to provide a way to manage modifiers and make them
discoverable.
Let's say we want to build a benchmarking modifier to help us get a sense for how long our tasks are running.
Now that we have a new modifier defined, we can apply it to any tasks that we wish and have it apply the behavior we built. Let's see it in action!
Previous: Using maxConcurrency