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

[Feature Request]: Document webcontents.on('close') #36245

Open
3 tasks done
mesner opened this issue Nov 3, 2022 · 2 comments
Open
3 tasks done

[Feature Request]: Document webcontents.on('close') #36245

mesner opened this issue Nov 3, 2022 · 2 comments

Comments

@mesner
Copy link
Contributor

mesner commented Nov 3, 2022

Preflight Checklist

Problem Description

Proposed Solution

  • If approved, I believe the only necessary changes are to add the event to docs/api/web-contents.md and listeners and ensure they are fired in spec/api-web-contents-spec.ts.
  • EDIT: I see that a preventDefault is added by default to emitted events. Should the CloseContents() method return early if it is prevented?

Alternatives Considered

  • Have window.close() within a browserview close the browserwindow it belongs to? This seems to have more risk of impact.
  • EDIT: browserview.on('close') event, but that would be the first documented BV event

Additional Information

I'd be happy to submit a PR for this if approved.

@codebytere
Copy link
Member

@nornagon what do you think?

@tdozbun-reno
Copy link

I see that a preventDefault is added by default to emitted events. Should the CloseContents() method return early if it is prevented?

This would be really nice to have, I'm currently dealing with a website that can call window.close(), which destroys the browser view and is not cancellable (the window stays open). my current choices are between recreating the view (and re-attaching events), or replacing window.close in the client JS with a stub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants