Chapter 6. Working with files

 

This chapter covers

  • Determining if the content has been edited and is unsaved
  • Modifying the window’s title based on the state of the currently active document
  • Using custom interactions available to windows in applications running on macOS
  • Implementing append documents to the operating system’s list of recent documents
  • Watching for changes to the current file from the operating system

Over the previous two chapters, we implemented the ability to read a file from the filesystem and display it in a browser window of our application. This exercise demonstrated how interprocess communication works in Electron, as well as Electron’s ability to bridge the gap between a traditional browser-based application and a Node.js application. In the previous chapter, we also added support for multiple browser windows.

6.1. Keeping track of the current file

6.2. Tracking recently opened files

6.3. Saving files

6.4. Opening files using drag and drop

6.5. Watching files for changes

6.6. Prompting the user before discarding changes

Summary