mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-22 20:39:17 +08:00
@@ -1032,6 +1032,7 @@ function TestControlFlow() {
|
||||
eventType = webdriver.promise.ControlFlow.EventType.UNCAUGHT_EXCEPTION;
|
||||
|
||||
var stringPromise: webdriver.promise.Promise<string>;
|
||||
stringPromise = flow.execute(function() { return 'value'; });
|
||||
stringPromise = flow.execute(function() { return stringPromise; });
|
||||
stringPromise = flow.execute(function() { return stringPromise; }, 'Description');
|
||||
|
||||
|
||||
18
selenium-webdriver/selenium-webdriver.d.ts
vendored
18
selenium-webdriver/selenium-webdriver.d.ts
vendored
@@ -1596,16 +1596,20 @@ declare module webdriver {
|
||||
|
||||
/**
|
||||
* Schedules a task for execution. If there is nothing currently in the
|
||||
* queue, the task will be executed in the next turn of the event loop.
|
||||
* queue, the task will be executed in the next turn of the event loop. If
|
||||
* the task function is a generator, the task will be executed using
|
||||
* {@link webdriver.promise.consume}.
|
||||
*
|
||||
* @param {!Function} fn The function to call to start the task. If the
|
||||
* function returns a {@link webdriver.promise.Promise}, this instance
|
||||
* will wait for it to be resolved before starting the next task.
|
||||
* @param {function(): (T|promise.Promise<T>)} fn The function to
|
||||
* call to start the task. If the function returns a
|
||||
* {@link webdriver.promise.Promise}, this instance will wait for it to be
|
||||
* resolved before starting the next task.
|
||||
* @param {string=} opt_description A description of the task.
|
||||
* @return {!webdriver.promise.Promise} A promise that will be resolved with
|
||||
* the result of the action.
|
||||
* @return {!promise.Promise<T>} A promise that will be resolved
|
||||
* with the result of the action.
|
||||
* @template T
|
||||
*/
|
||||
execute<T>(fn: Function, opt_description?: string): Promise<T>;
|
||||
execute<T>(fn: ()=>(T|Promise<T>), opt_description?: string): Promise<T>;
|
||||
|
||||
/**
|
||||
* Inserts a {@code setTimeout} into the command queue. This is equivalent to
|
||||
|
||||
Reference in New Issue
Block a user