arnaucube
arnaucube/blockchainIDsystemPublic Self-hosted repository
blockchainIDsystem/clientApp/GUI/main.js
clientApp/GUI/main.jsRaw
 1const electron = require('electron')
 2// Module to control application life.
 3const app = electron.app
 4// Module to create native browser window.
 5const BrowserWindow = electron.BrowserWindow
 6
 7const Tray = electron.Tray
 8const Menu = electron.Menu
 9
10// Keep a global reference of the window object, if you don't, the window will
11// be closed automatically when the JavaScript object is garbage collected.
12let mainWindow
13
14
15function createWindow () {
16  // Create the browser window.
17  mainWindow = new BrowserWindow({
18    width: 850,
19    height: 600,
20    icon: 'img/darkID-logo-white.png'
21  })
22  tray = new Tray('img/darkID-logo-white.png')
23  const contextMenu = Menu.buildFromTemplate([
24    {label: 'Obre la finestra', type: 'radio'},
25    {label: 'javascript madness', type: 'radio'},
26    {label: 'Tanca', type: 'radio'}
27    //{label: 'Tanca', type: 'radio', checked: true}
28  ])
29  tray.setToolTip('Panopticon, projectNSA')
30  tray.setContextMenu(contextMenu)
31
32  mainWindow.setMenu(null);
33
34  // and load the index.html of the app.
35  mainWindow.loadURL(`file://${__dirname}/index.html`)
36
37  // Open the DevTools.
38  //mainWindow.webContents.openDevTools()
39
40  // Emitted when the window is closed.
41  mainWindow.on('closed', function () {
42    // Dereference the window object, usually you would store windows
43    // in an array if your app supports multi windows, this is the time
44    // when you should delete the corresponding element.
45    mainWindow = null
46  })
47}
48
49// This method will be called when Electron has finished
50// initialization and is ready to create browser windows.
51// Some APIs can only be used after this event occurs.
52app.on('ready', createWindow)
53
54// Quit when all windows are closed.
55app.on('window-all-closed', function () {
56  // On OS X it is common for applications and their menu bar
57  // to stay active until the user quits explicitly with Cmd + Q
58  if (process.platform !== 'darwin') {
59    app.quit()
60  }
61})
62
63app.on('activate', function () {
64  // On OS X it's common to re-create a window in the app when the
65  // dock icon is clicked and there are no other windows open.
66  if (mainWindow === null) {
67    createWindow()
68  }
69})
70
71// In this file you can include the rest of your app's specific main process
72// code. You can also put them in separate files and require them here.