puter.ui.onWindowClose() Sets a function to run when the window is about to close.
For example, the function runs right after the user presses the window's 'X' button.
Note onWindowClose is not called when app is closed using puter.exit().
puter.ui.onWindowClose(handler)
handler (Function)
A function to execute when the window is going to close.
<html>
<body>
<script src="https://js.puter.com/v2/"></script>
<script>
puter.ui.onWindowClose(function(){
alert('Window is about to close!')
puter.exit();
})
</script>
</body>
</html>