Open jtassin opened 5 years ago
Looking for this as well. Any news?
@jtassin
Ideally the listener should get disposed when waitForAllXhrFinished()
promise gets resolved.
Moreover page should start listening when we make call to waitForAllXhrFinished()
instead of in constructor. This will stop unnecessary listening of requests.
Using this mechanism, we can use the same coding pattern as suggested by puppeteer -
await Promise.all([
pendingXHR.waitForAllXhrFinished(), // Listeners will start listening requests
page.click('a.my-link') // Click happened which triggered requests
]);
What do you think? I can raise the merge request if we agree.
I have created new package @agabhane/puppeteer-pending-requests with above requirements and few enhancements.
@agabhane your idea makes sense
Their is a PR for a cleanup behaviour : https://github.com/jtassin/pending-xhr-puppeteer/pull/112 more or less like your idea "listener should get disposed when waitForAllXhrFinished() promise gets resolved".
Your idea in puppeteer-pending-requests to add a timer is very good.
any progress on this issue?