2023-08-28 11:23:10 +00:00
|
|
|
const { app, BrowserWindow } = require('electron/main')
|
2023-07-17 08:30:53 +00:00
|
|
|
const fs = require('node:fs')
|
|
|
|
const path = require('node:path')
|
2020-11-30 07:48:39 +00:00
|
|
|
|
|
|
|
function createWindow () {
|
|
|
|
const win = new BrowserWindow({
|
|
|
|
width: 800,
|
2021-06-07 01:43:24 +00:00
|
|
|
height: 600
|
2020-11-30 07:48:39 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
win.loadFile('index.html')
|
|
|
|
}
|
2021-06-07 01:43:24 +00:00
|
|
|
|
2020-11-30 07:48:39 +00:00
|
|
|
const fileName = 'recently-used.md'
|
|
|
|
fs.writeFile(fileName, 'Lorem Ipsum', () => {
|
2021-06-07 01:43:24 +00:00
|
|
|
app.addRecentDocument(path.join(__dirname, fileName))
|
2020-11-30 07:48:39 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
app.whenReady().then(createWindow)
|
|
|
|
|
|
|
|
app.on('window-all-closed', () => {
|
|
|
|
app.clearRecentDocuments()
|
|
|
|
if (process.platform !== 'darwin') {
|
|
|
|
app.quit()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
app.on('activate', () => {
|
|
|
|
if (BrowserWindow.getAllWindows().length === 0) {
|
|
|
|
createWindow()
|
|
|
|
}
|
|
|
|
})
|