mirror of https://github.com/electron/electron
18 lines
422 B
HTML
18 lines
422 B
HTML
|
<html>
|
||
|
<body>
|
||
|
<script type="text/javascript" charset="utf-8">
|
||
|
function installBeforeUnload(removeAfterNTimes) {
|
||
|
let count = 0
|
||
|
window.addEventListener('beforeunload', function handler(e) {
|
||
|
setTimeout(() => console.log('beforeunload'))
|
||
|
if (++count <= removeAfterNTimes) {
|
||
|
e.preventDefault();
|
||
|
e.returnValue = '';
|
||
|
}
|
||
|
})
|
||
|
console.log('installed')
|
||
|
}
|
||
|
</script>
|
||
|
</body>
|
||
|
</html>
|