Need help understanding how pane works


I’m trying to develop a new feature that consists of a “no for all” and a “yes for all” button for the command pane:close.
I’ve had moderate success, although I don’t understand what the function confirmClose is supposed to do, since in the destroyItem, promptToSaveItem is called again (which, incidentally, causes atom to prompt twice for each file if you say no the first time).

So I commented confirmClose out of close, and the buttons work, but when there’s more than one pane, the pane that I’m trying to close doesn’t prompt at all for its unsaved files. I’ve verified that this doesn’t happen when confirmClose isn't commented.

I understand that the code that’s executed by destroy is different for when there’s more than one pane, but I don’t quite understand what it’s doing. If anyone could shed some light on this, it’d be much appreciated.

I would’ve put more links to the functions, but apparently there’s a cap of 2.indent preformatted text by 4 spaces