# Class webdriver.promise.Task_

code »

    webdriver.promise.Promise.<(T|null)>
      └ webdriver.promise.Deferred
          └ webdriver.promise.Node_
              └ webdriver.promise.Task_

All implemented interfaces:
  `webdriver.promise.Thenable.<(T|null)>`

A task to be executed by a `webdriver.promise.ControlFlow`.

## Constructor

webdriver.promise.Task_ ( flow, fn, description, snapshot )

Parameters

flow: `!webdriver.promise.ControlFlow`
  The flow this instances belongs to.
fn: `!Function`
  The function to call when the task executes. If it returns a `webdriver.promise.Promise`, the flow will wait for it to be resolved before starting the next task.
description: `string`
  A description of the task for debugging.
snapshot: `!webdriver.stacktrace.Snapshot`
  A snapshot of the stack when this task was scheduled.

Show:Public Protected Private

## Instance Methods

### Defined in `webdriver.promise.Task_`

code »execute ( )

Executes this task.

code »getDescription ( ) ⇒ `string`

Returns

This task's description.

code »toString ( ) ⇒ `string`

### Defined in `webdriver.promise.Node_`

code »getParent ( ) ⇒ `webdriver.promise.Node_`

Returns

This node's parent.

code »getRoot ( ) ⇒ `!webdriver.promise.Node_`

Returns

The root of this node's tree.

code »setParent ( parent )

Parameters

parent: `webdriver.promise.Node_`
  This node's new parent.

### Defined in `webdriver.promise.Deferred`

code »errback ( opt_error )

Rejects this promise. If the error is itself a promise, this instance will be chained to it and be rejected with the error's resolved value.

Parameters

opt_error: `*=`
  The rejection reason, typically either a `Error` or a `string`.

code »fulfill ( opt_value )

Resolves this promise with the given value. If the value is itself a promise and not a reference to this deferred, this instance will wait for it before resolving.

Parameters

opt_value: `T=`
  The fulfilled value.

code »reject ( opt_error )

Rejects this promise. If the error is itself a promise, this instance will be chained to it and be rejected with the error's resolved value.

Parameters

opt_error: `*=`
  The rejection reason, typically either a `Error` or a `string`.

code »removeAll ( )

Removes all of the listeners previously registered on this deferred.

Throws

`Error`
  If this deferred has already been resolved.

### Defined in `webdriver.promise.Promise.<(T|null)>`

code »cancel ( reason )

Parameters

reason

code »isPending ( ) ⇒ `boolean`
code »then ( opt_callback, opt_errback )

Parameters

opt_callback
opt_errback

code »thenCatch ( errback )

Parameters

errback

code »thenFinally ( callback )

Parameters

callback

## Instance Properties

### Defined in `webdriver.promise.Task_`

code »description_ : `string`
code »snapshot_ : `!webdriver.stacktrace.Snapshot`

### Defined in `webdriver.promise.Node_`

code »parent_ : `webdriver.promise.Node_`

This node's parent.

### Defined in `webdriver.promise.Deferred`

code »webdriver.promise.Deferred.prototype.promise : `webdriver.promise.Promise.<T>`

Represents the eventual value of a completed operation. Each promise may be in one of three states: pending, resolved, or rejected. Each promise starts in the pending state and may make a single transition to either a fulfilled or rejected state, at which point the promise is considered resolved.

## Static Properties

code »webdriver.promise.Task_.superClass_ : `webdriver.promise.Node_.prototype`