I’m writing a package for Atom for editing remote files with ssh/ftp, https://github.com/sveale/remote-edit.
The end user can add servers, and all my model classes are serializable so that the added servers can be stored along with metadata about any files that’s been downloaded.
I always assumed that the state that is returned to the activate method in the main class is global. Turns out this is infact session based. I’ve also forgotten to consider multiple editors being open at the same time and the package sharing data across these editors.
What’s the best way to store global data for a package? In a perfect world the data should be available to the package in all open editors at any given time. One solution that I’ve thought of would be to serialize the data on change and automatically write it to a file in the default atom folder, and have the package watch this file. This could lead to some deadlock issues, but since information has to be manually typed in this shouldn’t really be a problem.
Anyone got any tips/ideas? Can I use a singleton class for this?