Class webdriver.promise.Frame_

code »
webdriver.promise.Promise.<(T|null)>
  └ webdriver.promise.Deferredwebdriver.promise.Node_
          └ webdriver.promise.Frame_
All implemented interfaces:
webdriver.promise.Thenable.<(T|null)>

An execution frame within a webdriver.promise.ControlFlow. Each frame represents the execution context for either a webdriver.promise.Task_ or a callback on a webdriver.promise.Deferred.

Each frame may contain sub-frames. If child N is a sub-frame, then the items queued within it are given priority over child N+1.

Constructor

webdriver.promise.Frame_ ( flow )
Parameters
flow: !webdriver.promise.ControlFlow
The flow this instance belongs to.
Show:

Instance Methods

Defined in webdriver.promise.Frame_

Adds a new node to this frame.

Parameters
node: !(webdriver.promise.Frame_|webdriver.promise.Task_)
The node to insert.

Marks all of the tasks that are descendants of this frame in the execution tree as cancelled. This is necessary for callbacks scheduled asynchronous. For example: var someResult; webdriver.promise.createFlow(function(flow) { someResult = flow.execute(function() {}); throw Error(); }).addErrback(function(err) { console.log('flow failed: ' + err); someResult.then(function() { console.log('task succeeded!'); }, function(err) { console.log('task failed! ' + err); }); }); // flow failed: Error: boom // task failed! CanceledTaskError: Task discarded due to a previous // task failure: Error: boom

Parameters
error: !webdriver.promise.CanceledTaskError_
The cancellation error.
Returns
The task currently executing within this frame, if any.

Locks this frame.

Removes a child from this frame.

Parameters
child: !(webdriver.promise.Frame_|webdriver.promise.Task_)
The child to remove.
Parameters
task: webdriver.promise.Task_
The task currently executing within this frame, if any.
code »toString ( )string

Defined in webdriver.promise.Node_

Returns
This node's parent.
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.

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.Frame_

Whether this frame is active. A frame is considered active once one of its descendants has been removed for execution. Adding a sub-frame as a child to an active frame is an indication that a callback to a webdriver.promise.Deferred is being invoked and any tasks scheduled within it should have priority over previously scheduled tasks:

   var flow = webdriver.promise.controlFlow();
   flow.execute('start here', goog.nullFunction).then(function() {
     flow.execute('this should execute 2nd', goog.nullFunction);
   });
   flow.execute('this should execute last', goog.nullFunction);
 

Whether this frame is currently locked. A locked frame represents a callback or task function which has run to completion and scheduled all of its tasks.

Once a frame becomes active, any new frames which are added represent callbacks on a webdriver.promise.Deferred, whose tasks must be given priority over previously scheduled tasks.

A reference to the last node inserted in this frame.

The task currently being executed within this frame.

Defined in webdriver.promise.Node_

Defined in webdriver.promise.Deferred

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