INNER CODE UNIT · JavaScript
resize
bablosoft/puppeteer-with-fingerprints · src/index.js:35
const resize = async (page) => {
const { width, height } = await getViewport(page);
if (width !== bounds.width || height !== bounds.height) {
await sync(() => setViewport(page, bounds));
}
};
bindHooks(browser, { onPageCreated: resize });
// Resize on startup only if there are open pages.
if (browser.pages) {
const [page] = await browser.pages();
if (page) await resize(page);
}
}
}
/**