monaco-editor/samples/electron-amd/main.js

33 lines
669 B
JavaScript
Raw Normal View History

2020-09-02 23:35:10 +08:00
const electron = require('electron');
const app = electron.app;
const BrowserWindow = electron.BrowserWindow;
let mainWindow;
function createWindow() {
2020-09-21 20:07:25 +08:00
mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: { worldSafeExecuteJavaScript: true }
});
2020-09-02 23:35:10 +08:00
mainWindow.loadURL(`file://${__dirname}/electron-index.html`);
mainWindow.webContents.openDevTools();
mainWindow.on('closed', function () {
mainWindow = null;
});
}
app.on('ready', createWindow);
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('activate', function () {
if (mainWindow === null) {
createWindow();
}
});