mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
Implement page.waitForFunction method
The page.waitForFunction method allows to wait for a general predicate. The predicate will be continiously polled for in page, until it either returns true or the timeout happens. The polling parameter could be one of the following: - 'raf' - to poll on every animation frame - 'mutation' - to poll on every dom mutation - <number> - to poll every X milliseconds References #91
This commit is contained in:
@@ -23,7 +23,7 @@ class Helper {
|
||||
* @return {string}
|
||||
*/
|
||||
static evaluationString(fun, ...args) {
|
||||
if (typeof fun === 'string') {
|
||||
if (Helper.isString(fun)) {
|
||||
console.assert(args.length === 0, 'Cannot evaluate a string with arguments');
|
||||
return fun;
|
||||
}
|
||||
@@ -181,6 +181,22 @@ class Helper {
|
||||
static recordPublicAPICoverage() {
|
||||
apiCoverage = new Map();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {!Object} obj
|
||||
* @return {boolean}
|
||||
*/
|
||||
static isString(obj) {
|
||||
return typeof obj === 'string' || obj instanceof String;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {!Object} obj
|
||||
* @return {boolean}
|
||||
*/
|
||||
static isNumber(obj) {
|
||||
return typeof obj === 'number' || obj instanceof Number;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Helper;
|
||||
|
||||
Reference in New Issue
Block a user