Class: Task

Task

new Task()

The Task object lives on a host Ember object (e.g. a Component, Route, or Controller). You call the .perform() method on this object to create run individual TaskInstances, and at any point, you can call the .cancelAll() method on this object to cancel all running or enqueued TaskInstances.

Source:

Members

(readonly) isIdle :boolean

true if the task is not in the running or queued state.

Type:
  • boolean
Source:

(readonly) isQueued :boolean

true if any future task instances are queued.

Type:
  • boolean
Source:

(readonly) isRunning :boolean

true if any current task instances are running.

Type:
  • boolean
Source:

(readonly) last :TaskInstance

The most recently started task instance.

Type:
Source:

(readonly) lastCanceled :TaskInstance

The most recently canceled task instance.

Type:
Source:

(readonly) lastComplete :TaskInstance

The most recently completed task instance.

Type:
Source:

(readonly) lastErrored :TaskInstance

The most recent task instance that errored.

Type:
Source:

(readonly) lastIncomplete :TaskInstance

The most recent task instance that is incomplete.

Type:
Source:

(readonly) lastPerformed :TaskInstance

The most recently performed task instance.

Type:
Source:

(readonly) lastRunning :TaskInstance

The most recent task instance that is currently running.

Type:
Source:

(readonly) lastSuccessful :TaskInstance

The most recent task instance that succeeded.

Type:
Source:

(readonly) performCount :number

The number of times this task has been performed.

Type:
  • number
Source:

(readonly) state :string

The current state of the task: "running", "queued" or "idle".

Type:
  • string
Source:

Methods

cancelAll()

Cancels all running or queued TaskInstances for this Task. If you're trying to cancel a specific TaskInstance (rather than all of the instances running under this task) call .cancel() on the specific TaskInstance.

Source:

perform(arg*)

Creates a new TaskInstance and attempts to run it right away. If running this task instance would increase the task's concurrency to a number greater than the task's maxConcurrency, this task instance might be immediately canceled (dropped), or enqueued to run at later time, after the currently running task(s) have finished.

Parameters:
Name Type Description
arg* *

args to pass to the task function

Source:
Fires: