Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upwebContents‘s will-prevent-unload event is helpless for true use #24994
Labels
Comments
|
I agree the API design is wrong. We should provide a callback to pass the result asynchronously. |
|
@zcbenz I'm new to contributing to Electron, so I'd like to work on this |
|
good |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When developers use webContents‘s
will-prevent-unloadevent,They want to ask the user to confirm something most of the time.
Like this:
Actually,They can not use
dialog.showMessageBoxSync,because
dialog.showMessageBoxSyncis synchronous,It will block the main process event loop, and cause some unpredictable problems.
But They can not use the asynchronous method
dialog.showMessageBoxeither,because
dialog.showMessageBoxcan not prevent thewill-prevent-unloadeventCode: