From 97cf24ac98333187eaea2eaf2c64a72f5bcba64b Mon Sep 17 00:00:00 2001 From: CoderPoet Date: Mon, 10 Feb 2020 16:12:30 +0800 Subject: [PATCH] docs: modify the showMessageBox method to showMessageBoxSync (#22080) In handling the will-prevent-unload event, preventDefault should be executed synchronously, and here should also be showMessageBoxSync --- docs/api/web-contents.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/web-contents.md b/docs/api/web-contents.md index 35a693d92829..e28d593ab79d 100644 --- a/docs/api/web-contents.md +++ b/docs/api/web-contents.md @@ -310,7 +310,7 @@ and allow the page to be unloaded. const { BrowserWindow, dialog } = require('electron') const win = new BrowserWindow({ width: 800, height: 600 }) win.webContents.on('will-prevent-unload', (event) => { - const choice = dialog.showMessageBox(win, { + const choice = dialog.showMessageBoxSync(win, { type: 'question', buttons: ['Leave', 'Stay'], title: 'Do you want to leave this site?',