electron/spec/fixtures/api/close-beforeunload-false.html
2019-07-02 13:48:58 -07:00

19 lines
513 B
HTML

<html>
<body>
<script type="text/javascript" charset="utf-8">
// Only prevent unload on the first window close
var unloadPrevented = false;
window.onbeforeunload = function() {
setTimeout(function() {
require('electron').remote.getCurrentWindow().emit('onbeforeunload');
}, 0);
if (!unloadPrevented) {
unloadPrevented = true;
return false;
}
}
// unload events don't get run unless load events have run.
window.onload = () => window.close()
</script>
</body>
</html>