mirror of
https://github.com/electron/electron.git
synced 2026-01-09 15:38:08 -05:00
feat: add app.getRecentDocuments() (#45839)
feat: add app.getRecentDocuments()
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user