Merge pull request #209 from electron/update-main
feat: update index loading for new API
This commit is contained in:
commit
dc1585b235
16
main.js
16
main.js
|
@ -1,11 +1,5 @@
|
||||||
const electron = require('electron')
|
// Modules to control application life and create native browser window
|
||||||
// Module to control application life.
|
const {app, BrowserWindow} = require('electron')
|
||||||
const app = electron.app
|
|
||||||
// Module to create native browser window.
|
|
||||||
const BrowserWindow = electron.BrowserWindow
|
|
||||||
|
|
||||||
const path = require('path')
|
|
||||||
const url = require('url')
|
|
||||||
|
|
||||||
// Keep a global reference of the window object, if you don't, the window will
|
// Keep a global reference of the window object, if you don't, the window will
|
||||||
// be closed automatically when the JavaScript object is garbage collected.
|
// be closed automatically when the JavaScript object is garbage collected.
|
||||||
|
@ -16,11 +10,7 @@ function createWindow () {
|
||||||
mainWindow = new BrowserWindow({width: 800, height: 600})
|
mainWindow = new BrowserWindow({width: 800, height: 600})
|
||||||
|
|
||||||
// and load the index.html of the app.
|
// and load the index.html of the app.
|
||||||
mainWindow.loadURL(url.format({
|
mainWindow.loadFile('index.html')
|
||||||
pathname: path.join(__dirname, 'index.html'),
|
|
||||||
protocol: 'file:',
|
|
||||||
slashes: true
|
|
||||||
}))
|
|
||||||
|
|
||||||
// Open the DevTools.
|
// Open the DevTools.
|
||||||
// mainWindow.webContents.openDevTools()
|
// mainWindow.webContents.openDevTools()
|
||||||
|
|
Loading…
Reference in New Issue