GoogleChromeLabs / carlo

Web rendering surface for Node applications
Apache License 2.0
9.31k stars 309 forks source link

Add event to intercept and prevent window closing #131

Open gadamsgh opened 5 years ago

gadamsgh commented 5 years ago

The window class emits an event when the window is already closed. I'd like to have the ability to intercept the attempted close and cancel it if desired. The primary use case would be to allow certain types of cleanup/saving code on the launched website to finish execution before terminating the window/process.

Could this be added as an enhancement?

pavelfeldman commented 5 years ago

Would onbeforeunload-alike behavior work for you? You can call a binding / rpc method from within the handler synchronously, it should work.