Quit event?


#1

Is there a quit event that plugins can use to save state or similar, before an Atom window is quit? If so, where’s docs on that?


#2

Serialising? It’s in the flight manual.
https://flight-manual.atom.io/behind-atom/sections/serialization-in-atom/

It’s also talked about in the package making guide part
https://flight-manual.atom.io/hacking-atom/sections/package-active-editor-info/#serialization


#3

“serialization” in no way hints at an “on exit” hook, but now that I read it, I see that it is just what I need. Thanks!

I was wondering because I would like to update the atom-vim-like-tab plugin so that it restores tabs when restarting Atom. This plugin is a nice concept: it lets us make news tabs in which we can have split panes (similar to vim window splits inside tabs).


#4

It’s not. It’s constantly firing, so don’t put anything expensive or prone to breaking noisily in the serialize() method. If Atom is open, it is recording the current state to be restored in the future, and it saves that info to disk automatically in case the program stops working suddenly. It does this through calling all serialize() methods that have been given to it (via registering packages and views).