electron/docs/fiddles/features/represented-file/main.js
Kevin Hartman 3e2ec0e2ce
docs: Update represented-file fiddle tutorial (#29245)
* Update represented-file fiddle.

* add index and code back to guide

Co-authored-by: Ethan Arrowood <ethan.arrowood@gmail.com>
2021-06-15 10:29:51 +09:00

30 lines
553 B
JavaScript

const { app, BrowserWindow } = require('electron')
const os = require('os');
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600
})
win.loadFile('index.html')
}
app.whenReady().then(() => {
const win = new BrowserWindow()
win.setRepresentedFilename(os.homedir())
win.setDocumentEdited(true)
})
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})