Skip to content

Commit 5c9d46b

Browse files
authored
Update puppeteer.ts
1 parent 763c526 commit 5c9d46b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

api/_lib/puppeteer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ async function getPage() {
1717

1818
export async function getScreenshot(url, width, height) {
1919
const page = await getPage();
20+
await page.setViewport({ width: Number(width) || 1280, height: Number(height) || 720, deviceScaleFactor: 2 });
2021
await page.goto(url);
21-
await page.setViewport({ width: Number(width) || 1280, height: Number(height) || 720, deviceScaleFactor: 2 });
22+
await new Promise(r => setTimeout(r, 3000));
2223
const file = await page.screenshot();
2324
return file;
2425
}

0 commit comments

Comments
 (0)