Improve documentation for the page.waitFor method.

Fixes #109.
This commit is contained in:
Andrey Lushnikov
2017-07-25 08:46:11 -07:00
parent 877f06aacb
commit b564029589
3 changed files with 26 additions and 21 deletions

View File

@@ -252,16 +252,16 @@ class Frame {
}
/**
* @param {(string|number)} target
* @param {(string|number)} selectorOrTimeout
* @param {!Object=} options
* @return {!Promise}
*/
waitFor(target, options = {}) {
if (typeof target === 'string' || target instanceof String)
return this.waitForSelector(target, options);
if (typeof target === 'number' || target instanceof Number)
return new Promise(fulfill => setTimeout(fulfill, target));
return Promise.reject(new Error('Unsupported target type: ' + (typeof target)));
waitFor(selectorOrTimeout, options = {}) {
if (typeof selectorOrTimeout === 'string' || selectorOrTimeout instanceof String)
return this.waitForSelector(selectorOrTimeout, options);
if (typeof selectorOrTimeout === 'number' || selectorOrTimeout instanceof Number)
return new Promise(fulfill => setTimeout(fulfill, selectorOrTimeout));
return Promise.reject(new Error('Unsupported target type: ' + (typeof selectorOrTimeout)));
}
/**