Skip to content

Conversation

@JoelEinbinder
Copy link
Contributor

* @param {number} timeout
*/
constructor(frame, predicateBody, polling, timeout) {
constructor(frame, predicateBody, polling, timeout, ...args) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: missing jsdoc for args

return await pollInterval(polling);

/**
* @return {!Promise}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@return {!Promise<*>}

if (polling === 'raf')
await pollRaf();
return await pollRaf();
else if (polling === 'mutation')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: drop elses


if (this._terminated || runCount !== this._runCount)
if (this._terminated || runCount !== this._runCount) {
success && await success.dispose();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (success)
..

const polling = options.polling || 'raf';
const predicateCode = 'return ' + helper.evaluationString(pageFunction, ...args);
return new WaitTask(this, predicateCode, polling, timeout).promise;
if (helper.isString(pageFunction))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's move this to the waitTask

@aslushnikov aslushnikov merged commit 05b1aca into puppeteer:master Jan 4, 2018
igorshapiro pushed a commit to WiserSolutions/puppeteer that referenced this pull request Jan 16, 2018
This patch:
- teaches page.waitFor* methods to accept JSHandles
- starts returning JSHandles from page.waitFor* calls. 

BREAKING CHANGE: this patch starts allocating `JSHandle`/`ElementHandle` instances for every call to `page.waitFor*` functions. These handles should be disposed manually to avoid memory consumption.

Fixes puppeteer#1703, fixes puppeteer#1654, fixes puppeteer#1724.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants