ember-concurrency 2.0 is primarily an "engine" replacement. Internally, its been substantially rewritten and decoupled from Ember at it's core. This will enable a much more maintainable codebase, as well as setting the stage for potential extraction of core primatives for us in the broader JavaScript ecosystem.
The application developer-facing changes are fairly minimal, and there are few potentially breaking semantic changes to the operation of the addon.
Please review the 2.0 Upgrade Guide for a thorough description of the changes for app and addon users alike.
New Features
-
Use
@tracked
underneath on Ember 3.16+ (#354)Note: Within applications with both tracked & computed properties,
if using a native getter to access task state, and wishing to use it
alongside a computed property, @dependantKeyCompat will need to be used on
the getter as expected with any other tracked-prop using getter. -
Implement decorators from
ember-concurrency-decorators
. The "nice" decorators
fromember-concurrency-decorators
are now built-in to ember-concurrency, without
requiring an additional addon or seperate import. All decorators are available for
import directly from the top-levelember-concurrency
package.Addon maintainers: Please see notes in
UPGRADING-2.x.md
if you're using
decorators currently, and wish to support both ember-concurrency 1.x and 2.x at
runtime.
Enhancements
-
Migrate task lifetimes to
@ember/destroyable
underneath, rather than
patchingwillDestroy
(#377).Potentially breaking: this drops support for Node 8 and Ember < 3.8 LTS
-
[docs] Rewrite documentation to use native classes and decorators, and update tutorial
to show rewriting of async function code, rather than Promise code, as is more common
today. -
Make
Task#cancelAll
andTaskInstance#cancel
awaitable (#396). See
topic in UPGRADING-2.x.md for more info.
Removals
-
Remove ability to directly use tasks with
{{action}}
helper stuff
(deprecated in 1.3.0) (#374) -
Remove
get
andset
compatibility methods fromTask
,TaskGroup
,
andTaskInstance
. -
Drop unused
broccoli-file-creator
andember-maybe-import-regenerator
dependencies.Note on
ember-maybe-import-regenerator
: This was originally added back when
generator support in browsers was far lower and Babel 5 and 6 were used. The
addon does nothing for Babel 7, which is used forember-concurrency
these
days. Tweakingconfig/targets.js
or adding the regenerator Babel plugin to
your babel config can be done instead if the regenerator runtime is needed
to transpile generators for older browsers.