Serializing state of dock for package


I am working on migrating an existing package from using a panel to the Dock API. I can toggle showing the custom Dock item per the flight manual tutorial. I am now trying to figure out how to serialize the package state so that if the Dock item is visible, it is reloaded when atom is reopened.

I can test to see if the Dock item is present using atom.workspace.getPaneItems(), and serializing a boolean in the package state if an item that is an instance of my custom item is present. However, if the item’s visibility is toggled, or the “arrow” is used to hide the dock, the item still exists. Is there a recommended way to determine if a Dock item is both present and visible? Is there a more typical way to let Atom itself serialize the state of the entire workspace with my custom item?


I haven’t worked with this specific part of the package API, but based on what I read in the Flight Manual, I would expect that having serialize() and deserialize() methods in the item you’re adding to the dock should be sufficient for Atom to do its thing.


Sorry for the late response (I wonder if my email notifications went to spam). I think my misunderstanding might be that the dock itself doesn’t have any state to serialize/deserialize. I simply wanted to know if it exists. However, from looking at some other packages, e.g. Debugger, it seems like it isn’t unusual for a hidden but extant dock to “come back” after reloading Atom.