Window reload event?


What’s the appropriate event to listen to for a window reload?

I’ve tried a number of options such as dom-ready which does trigger when the window is created, but not when the window is manually reloaded with CMD+R.

I’ve also tried devtools-reload-page with no success.



I am also having trouble figuring which event I should listen for a window reload.

I am spawning multiple processes and need to kill these processes before the reload event otherwise they all throw exceptions since about the PORT already being used.


You can listen to the beforeunload dom event, which is triggered when a window is being closed and when a window is being reloaded. It’s mentioned in the docs for the close event.