Skip to content

Commit 1af9df9

Browse files
committed
add some docs about .debug()
1 parent e3b53a4 commit 1af9df9

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

addon/-task-property.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,28 @@ objectAssign(TaskProperty.prototype, propertyModifiers, {
514514
* @param {Number} n The maximum number of concurrently running tasks
515515
* @instance
516516
*/
517+
518+
/**
519+
* Adds this task to a TaskGroup so that concurrency constraints
520+
* can be shared between multiple tasks.
521+
*
522+
* [See the Task Group docs for more information](/#/docs/task-groups)
523+
*
524+
* @method group
525+
* @memberof TaskProperty
526+
* @param {String} groupPath A path to the TaskGroup property
527+
* @instance
528+
*/
529+
530+
/**
531+
* Logs lifecycle events to aid in debugging unexpected Task behavior.
532+
* Presently only logs cancelation events and the reason for the cancelation,
533+
* e.g. "TaskInstance 'doStuff' was canceled because the object it lives on was destroyed or unrendered"
534+
*
535+
* @method debug
536+
* @memberof TaskProperty
537+
* @instance
538+
*/
517539
});
518540

519541
function defaultDebugCallback(payload) {

tests/dummy/app/docs/testing-debugging/template.hbs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,19 @@
121121
functions (Chrome's implementation only became spec-compliant around June, 2016).
122122
</p>
123123

124+
<h4>Unexpected Cancelation</h4>
125+
126+
<p>
127+
Sometimes it's not obvious why a Task was canceled; in these cases you
128+
can use the <code>.debug()</code> Task Modifier on a specific task e.g.
129+
<code>nameOfTask: task(...).debug()</code>,
130+
which will provide some logging about the task's lifecycle, e.g.
131+
<code>TaskInstance 'nameOfTask' was canceled because the object it lives on was destroyed or unrendered </code>.
132+
</p>
133+
134+
<p>
135+
To enable lifecycle logging on ALL ember-concurrency tasks, you can enable the <code>DEBUG_TASKS</code>
136+
flag on <code>EmberENV</code> in your project's <code>config/environment.js</code> file.
137+
</p>
138+
139+

0 commit comments

Comments
 (0)