Merge pull request #10356 from electron/update-browser-window-docs

update browser-window.md
This commit is contained in:
Zeke Sikelianos 2017-08-26 20:03:55 -07:00 committed by GitHub
commit 87d4666648

View file

@ -410,9 +410,10 @@ window.onbeforeunload = (e) => {
// a non-void value will silently cancel the close.
// It is recommended to use the dialog API to let the user confirm closing the
// application.
e.returnValue = false
e.returnValue = false // equivalent to `return false` but not recommended
}
```
_**Note**: There is a subtle difference between the behaviors of `window.onbeforeunload = handler` and `window.addEventListener('beforeunload', handler)`. It is recommended to always set the `event.returnValue` explicitly, instead of just returning a value, as the former works more consistently within Electron._
#### Event: 'closed'