puppeteer-cluster
puppeteer-cluster copied to clipboard
How to do one-time setup ?
Hi,
I want to prevent some files from loading, and for that, I need to intercept requests for each page object, this is done by
page.on('request', (request) => {
// block
});
The problem is, how can I ensure this setup is run just once ? otherwise I am risking that I will add multiple event handlers that do the exact same thing over and over again. For now, I am adding a flag to the page object to tell if I already attached an the request handler (but don't feel like the right way);
@asafyish did you ever figure this out?