Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const { app, BrowserWindow } = require("electron"),
- path = require("path"),
- url = require("url");
- const {
- default: installExtension,
- REACT_DEVELOPER_TOOLS
- } = require("electron-devtools-installer");
- let mainWindow;
- function createWindow() {
- mainWindow = new BrowserWindow({
- width: 1000,
- height: 600,
- frame: false
- });
- mainWindow.loadURL(
- url.format({
- pathname: path.join(__dirname, "index.html"),
- protocol: "file:",
- slashes: true
- })
- );
- installExtension(REACT_DEVELOPER_TOOLS)
- .then(name => console.log(`Add Extension: ${name}`))
- .catch(err => console.log(`An error occurred: ${err}`));
- mainWindow.on("closed", () => {
- mainWindow = null;
- });
- }
- app.on("ready", createWindow);
- app.on("window-all-closed", () => {
- // quit app when it's not OS X
- if (process.platform !== "darwin") {
- app.quit();
- }
- });
- // Reactivate a window in OS X
- app.on("activate", () => {
- if (mainWindow === null) {
- createWindow();
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement