I am new to Electron.js. I was following a youtube tutorial for learning electron but this "The default of contextIsolation is deprecated and will be changing from false to true in a future release of Electron. See https://github.com/electron/electron/issues/23506 for more information" appears in my console. My main.js file is given below:
const electron = require('electron');
const url = require('url');
const path = require('path');
const {app , BrowserWindow,Menu}=electron;
let mainWindow;
//Listen for app to be ready
app.on('ready',function() {
//create new window
mainWindow=new BrowserWindow({});
//load html into window
mainWindow.loadURL(url.format({
pathname:path.join(__dirname,'mainWindow.html'),
protocol:'file',
slashes:true
}))
//Quit app when closed
mainWindow.on('closed',function(){
app.quit();
})
//build menu from template
const mainMenu=Menu.buildFromTemplate(mainMenuTemplate);
//insert menu
Menu.setApplicationMenu(mainMenu);
});
//handle create add window
function createAddWindow(){
//create new window
addWindow=new BrowserWindow({
width:300,
height:200,
title:'add shopping list item'
});
//load html into window
addWindow.loadURL(url.format({
pathname:path.join(__dirname,'addWndow.html'),
protocol:'file',
slashes:true
}));
//Garbage collection handle
addWindow.on('close',function(){
addWindow=null;
})
}
//Create Menu template
const mainMenuTemplate=[
{
label:'File',
submenu:[
{
label:'Add Item',
click(){
createAddWindow();
}
},
{
label:'Clear Items'
},
{
label:'Quit',
accelerator:process.platform== 'darwin' ? 'command+Q' : 'ctrl+Q',
click(){
app.quit(); }
},
]
}
]