Chapter 12. Persisting user data and using native Node.js modules
This chapter covers
- Using Node.js modules built with C++ in your main and renderer processes
- Getting the correct versions of your dependencies for Electron’s version of Node
- Using SQLite and IndexedDB databases to persist data
- Storing user-specific application data in the operating system’s designated location
In chapter 11, we built a small application to track items we needed to pack between trips. By the end of the chapter, we got the UI working, but the application still had a fatal flaw: it lost all of its data whenever the page refreshed. That’s a bit of a deal killer for an application that is allegedly supposed to help you remember things. Fire Sale was working with files stored on disk, so it wasn’t an issue, but Clipmaster and Clipmaster 9000 had this problem as well. All clippings were lost whenever a user quit the application, or we refreshed the page in development.