feat: add app.getRecentDocuments() (#45839)

feat: add app.getRecentDocuments()
This commit is contained in:
Shelley Vohr
2025-07-31 16:15:33 +02:00
committed by GitHub
parent 2c916cfa33
commit ecb1eb0b5d
8 changed files with 142 additions and 11 deletions

View File

@@ -776,6 +776,22 @@ bar, and on macOS, you can visit it from dock menu.
Clears the recent documents list.
### `app.getRecentDocuments()` _macOS_ _Windows_
Returns `string[]` - An array containing documents in the most recent documents list.
```js
const { app } = require('electron')
const path = require('node:path')
const file = path.join(app.getPath('desktop'), 'foo.txt')
app.addRecentDocument(file)
const recents = app.getRecentDocuments()
console.log(recents) // ['/path/to/desktop/foo.txt'}
```
### `app.setAsDefaultProtocolClient(protocol[, path, args])`
* `protocol` string - The name of your protocol, without `://`. For example,