Skip to content

Commit

Permalink
page.waitForTimeout is gone, just use promisified setTimeout from Nod…
Browse files Browse the repository at this point in the history
  • Loading branch information
macbre committed Mar 10, 2024
1 parent a74cc03 commit 3db1431
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions extensions/postLoadDelay/postLoadDelay.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
*/
"use strict";

const { setTimeout } = require("timers/promises");

module.exports = function (phantomas) {
// e.g. --post-load-delay 5
var delay = parseInt(phantomas.getParam("post-load-delay"), 10);
Expand All @@ -14,9 +16,9 @@ module.exports = function (phantomas) {
// https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#framewaitforselectororfunctionortimeout-options-args
phantomas.log("Will wait %d second(s) after load", delay);

phantomas.on("beforeClose", (page) => {
phantomas.on("beforeClose", async (page) => {

Check failure on line 19 in extensions/postLoadDelay/postLoadDelay.js

View workflow job for this annotation

GitHub Actions / lint

'page' is defined but never used
phantomas.log("Sleeping for %d seconds", delay);

return page.waitForTimeout(delay * 1000);
return setTimeout(delay * 1000);
});
};

0 comments on commit 3db1431

Please sign in to comment.