Class webdriver.promise.Frame_
code »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
Parameters |
---|
|
Instance Methods
Adds a new node to this frame.
Parameters |
---|
|
code »cancelRemainingTasks ( reason )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! CancelledTaskError: Task discarded due to a previous
// task failure: Error: boom
Parameters |
---|
|
Returns |
---|
|
Returns |
---|
|
Returns |
---|
|
Returns |
---|
|
code »removeChild ( child )Removes a child from this frame.
Parameters |
---|
|
Parameters |
---|
|
code »setPendingTask ( task )
Parameters |
---|
|
Instance Properties
Whether this frame is currently locked. A locked frame represents an
executed function that has scheduled all of its tasks.
Once a frame becomes locked, any new frames which are added as children
represent interrupts (such as a webdriver.promise.Promise
callback) whose tasks must be given priority over those already scheduled
within this frame. For example:
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);
webdriver.promise.Promise
callback) whose tasks must be given priority over those already scheduled
within this frame. For example:
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);
code »onComplete : ?function()
The function to notify if this frame executes without error.
?function()