react file tree electron example

Solutions on MaxInterview for react file tree electron example by the best coders in the world

showing results for - "react file tree electron example"
Bree
25 Feb 2018
1const path = require('path');
2
3const { app, BrowserWindow } = require('electron');
4const isDev = require('electron-is-dev');
5
6function createWindow() {
7  // Create the browser window.
8  const win = new BrowserWindow({
9    width: 800,
10    height: 600,
11    webPreferences: {
12      nodeIntegration: true,
13    },
14  });
15
16  // and load the index.html of the app.
17  // win.loadFile("index.html");
18  win.loadURL(
19    isDev
20      ? 'http://localhost:3000'
21      : `file://${path.join(__dirname, '../build/index.html')}`
22  );
23  // Open the DevTools.
24  if (isDev) {
25    win.webContents.openDevTools({ mode: 'detach' });
26  }
27}
28
29// This method will be called when Electron has finished
30// initialization and is ready to create browser windows.
31// Some APIs can only be used after this event occurs.
32app.whenReady().then(createWindow);
33
34// Quit when all windows are closed, except on macOS. There, it's common
35// for applications and their menu bar to stay active until the user quits
36// explicitly with Cmd + Q.
37app.on('window-all-closed', () => {
38  if (process.platform !== 'darwin') {
39    app.quit();
40  }
41});
42
43app.on('activate', () => {
44  if (BrowserWindow.getAllWindows().length === 0) {
45    createWindow();
46  }
47});
48