Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

electron main.js template

const {app, BrowserWindow} = require('electron');

function createWindow () {
	
  console.log('Hello from electron');
	
  // Create the browser window.
  mainWindow = new BrowserWindow({width: 800, height: 600})

  // and load the index.html of the app.
  mainWindow.loadURL(`file://${__dirname}/index.html`)

  // Open the DevTools.
  // mainWindow.webContents.openDevTools()

  // Emitted when the window is closed.
  mainWindow.on('closed', function () {
    // Dereference the window object, usually you would store windows
    // in an array if your app supports multi windows, this is the time
    // when you should delete the corresponding element.
    mainWindow = null
  })
}


app.on('ready', createWindow);

// Quit when all windows are closed.
app.on('window-all-closed', function () {
  // On OS X it is common for applications and their menu bar
  // to stay active until the user quits explicitly with Cmd + Q
  
  if (process.platform !== 'darwin') {
    app.quit()
  }
})

app.on('activate', function () {
  // On OS X it's common to re-create a window in the app when the
  // dock icon is clicked and there are no other windows open.
  
  if (mainWindow === null) {
    createWindow();
  }
})
Comment

PREVIOUS NEXT
Code Example
Javascript :: vue computed composition api 
Javascript :: slicknav cdn 
Javascript :: how to show day name in javascript using array 
Javascript :: copy file javascript 
Javascript :: react select with react hook form cotroller 
Javascript :: array.filter async 
Javascript :: convert base64 to image nodejs 
Javascript :: Sum of odd Fibonacci numbers JS 
Javascript :: postcss.config.js 
Javascript :: how to check if function is running js 
Javascript :: for of array javascript 
Javascript :: request body empty express 
Javascript :: discord.js add button to message 
Javascript :: check row empty array javascript 
Javascript :: save text to file nodejs 
Javascript :: tofixed currency in js 
Javascript :: props type 
Javascript :: ngmodel onchange 
Javascript :: how to create jquery function 
Javascript :: Binary Agents 
Javascript :: console table js 
Javascript :: remove first row from table jquery 
Javascript :: navigator.clipboard is undefined 
Javascript :: csrf token in js laravel 
Javascript :: joi validation custom message in node 
Javascript :: month list javascript 
Javascript :: website edit js 
Javascript :: swap key value object javascript 
Javascript :: timestamp to date javascript 
Javascript :: jquery get closest form 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =