beforeunload event during window close Vs meteor-auto-reload
问题 I use the follow function to detect window close event to perform some cleanup tasks: window.addEventListener('beforeunload', function(e) { console.log("window close"); // perform cleanup } Unfortunately I also get this event during meteor auto-reload (for ex. when there is change in code) during which I don't want to perform cleanup. How do I differentiate between the two situations? (I have a peculiar usecase where I have to differentiate between the two situations) 回答1: You would have to