Previous: Testing & Debugging
Next: FAQ & Fact Sheet
Ember Concurrency tasks play nicely with TypeScript and all of the APIs covered in these docs. Here is an example of a TypeScript component with an ember-concurrency task:
Ember Concurrency provides a template registry for using the
perform
,
cancel-all
, and
task
helpers within handlebars templates in Glint "loose mode". See the example
below for how to include Ember Concurrency's template registry in your Glint
configuration.
Here is an example of a modern .gts file in "strict mode" which imports the
classic
perform
helper from Ember Concurrency.
Note: while you can import and use the
perform
helper, it is actually recommended to use the
.perform()
method on each task, which is internally bound to the task (similar to methods
decorated with
@action
). One of the benefits of using the
.perform()
method is that it can be used with modern idiomatic patterns like using the
fn
helper to curry additional args when performing the task.
Pardon the lack of syntax! PR's welcome to improve our syntax highlighting!
Task
objectsIn most cases, you don't need to provide type annotations for your task, but when you do (such as when specifying the Args of a Glimmer component), you can use the Task type:
Previous: Testing & Debugging
Next: FAQ & Fact Sheet