We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 16efd76 + 286c998 commit b39145fCopy full SHA for b39145f
src/index.js
@@ -37,6 +37,7 @@ const screenshotSchema = z.object({
37
url: z.string().url(),
38
theme: z.enum(["light", "dark"]).default("light"),
39
headers: z.record(z.string(), z.any()),
40
+ sleep: z.number().min(0).max(60000).default(3000),
41
});
42
router.post(
43
"/v1/screenshots",
@@ -51,7 +52,11 @@ router.post(
51
52
await page.goto(body.url, {
53
waitUntil: "domcontentloaded",
54
- await page.waitForTimeout(3000); // Safe addition for any extra JS
55
+
56
+ if (body.sleep > 0) {
57
+ await page.waitForTimeout(body.sleep); // Safe addition for any extra JS
58
+ }
59
60
const screen = await page.screenshot();
61
await context.close();
62
return screen;
0 commit comments