diff --git a/packages/test-app/app/docs/controller.js b/packages/test-app/app/docs/controller.js index afd708676..5935db6e9 100644 --- a/packages/test-app/app/docs/controller.js +++ b/packages/test-app/app/docs/controller.js @@ -22,7 +22,7 @@ export const TABLE_OF_CONTENTS = [ { route: 'docs.derived-state', title: 'Derived State' }, { route: 'docs.events', title: 'Awaiting Events / Conditions' }, { route: 'docs.testing-debugging', title: 'Testing & Debugging' }, - { route: 'docs.typescript', title: 'TypeScript' }, + { route: 'docs.typescript', title: 'TypeScript / Glint' }, { route: 'docs.faq', title: 'FAQ & Fact Sheet' }, { section: 'Advanced' }, diff --git a/packages/test-app/app/docs/installation/template.hbs b/packages/test-app/app/docs/installation/template.hbs index 46dfaf4d7..50e7138b0 100644 --- a/packages/test-app/app/docs/installation/template.hbs +++ b/packages/test-app/app/docs/installation/template.hbs @@ -14,7 +14,6 @@
ember-cli-babel@^7.7.2
@babel/core@^7.5.0
(as a transitive dependency via ember-cli-babel
)ember-cli-typescript@^2.0.0
and TypeScript 4.2+, if you want to use it with TypeScript
+
- The documentation below covers how to use ember-concurrency v2.3+ - with Ember Octane. For older versions of ember-concurrency (or pre-Octane Ember), - please see the old guides. -
- -- 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 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:
Task
objects
- In 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:
+ 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.
- Support for TypeScript in ember-concurrency was recently greatly improved and simplified
- with the release of version 2.3, largely due to the introduction of the new
- async arrow task function syntax (e.g. myTask = task(async () => {})
),
- which alleviated most / all of the prior challenges with getting ember-concurrency tasks
- to play nicely with TypeScript.
+ Here is an example of a modern .gts file in "strict mode" which imports the
+ classic
+ perform
+ helper from Ember Concurrency.
taskFor()
function it provides is no longer necessary
- for interacting with tasks declared using the new syntax. See v2.3.0 and v2.3.2 release notes.
-
+ 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.
+
- If you would like to see the TypeScript guides for older versions of ember-concurrency - (or pre-Octane Ember), please - see the old guides. + Pardon the lack of syntax! PR's welcome to improve our syntax + highlighting!
+Task
objects+ In 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: +
+