Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Destroy listener on page change #27

Open
jtassin opened this issue Apr 4, 2019 · 5 comments
Open

Destroy listener on page change #27

jtassin opened this issue Apr 4, 2019 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@jtassin
Copy link
Owner

jtassin commented Apr 4, 2019

No description provided.

@jtassin jtassin added the bug Something isn't working label May 20, 2019
@gtyang
Copy link

gtyang commented Aug 2, 2019

any progress on this issue?

@pcordon
Copy link

pcordon commented Oct 27, 2019

Looking for this as well. Any news?

@agabhane
Copy link

@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.

@agabhane
Copy link

agabhane commented Jan 6, 2020

I have created new package @agabhane/puppeteer-pending-requests with above requirements and few enhancements.

@jtassin
Copy link
Owner Author

jtassin commented Apr 26, 2020

@agabhane your idea makes sense

Their is a PR for a cleanup behaviour : #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.

@jtassin jtassin self-assigned this Apr 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants