In Windows and macOS, you can see the recently opened documents by right-clicking on the taskbar icon or dock menu icon. The recent document list can be added to the application dock menu icon using Electron's app module. A recent list can be displayed by simply adding a file to the recent list in the app module:
const { app } = require('electron'); app.addRecentDocument('/User/Guest/Downloads/image.png');
You can clear the recent document list using the app.clearRecentDocuments
method. Adding a file path into the recent document list is very simple, as shown above. However, handling a user click event on the recent document list more important and difficult; it varies in different platforms. On macOS, clicking an item in the recent document list will emit an open-file
event on app module. This event should be handled properly to open the target file in your application. The following code snippet shows you to open the file from the recent...