Skip to content

Commit

Permalink
update .gitignore, remove index.ejs, add code comments to main process
Browse files Browse the repository at this point in the history
  • Loading branch information
SimulatedGREG committed Aug 27, 2017
1 parent 4f2531e commit 3a5914f
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 33 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
dist/
node_modules/
thumbs.db
!.gitkeep
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "electron-webpack-quick-start",
"version": "0.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"dev": "electron-webpack dev",
Expand Down
27 changes: 0 additions & 27 deletions src/index.ejs

This file was deleted.

13 changes: 13 additions & 0 deletions src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,17 @@ import { app, BrowserWindow } from 'electron'

const isDevelopment = process.env.NODE_ENV !== 'production'

// Global reference to mainWindow
// Neccessary to prevent win from being garbage collected
let mainWindow

function createMainWindow () {
// Construct new BrowserWindow
let win = new BrowserWindow()

// Set url for `win`
// points to `webpack-dev-server` in development
// points to `index.html` in production
let url = isDevelopment
? 'http://localhost:9080'
: `file://${__dirname}/index.html`
Expand All @@ -23,14 +30,20 @@ function createMainWindow () {
return win
}

// Quit application when all windows are closed
app.on('window-all-closed', () => {
// On macOS it is common for applications to stay open
// until the user explicitly quits
if (process.platform !== 'darwin') app.quit()
})

app.on('activate', () => {
// On macOS it is common to re-create a window
// even after all windows have been closed
if (mainWindow === null) mainWindow = createMainWindow()
})

// Create main BrowserWindow when electron is ready
app.on('ready', () => {
mainWindow = createMainWindow()
})
14 changes: 10 additions & 4 deletions src/renderer/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
document.getElementById('node').innerText = process.versions.node
document.getElementById('chrome').innerText = process.versions.chrome
document.getElementById('electron').innerText = process.versions.electron
document.getElementById('electron-webpack').innerText = require('electron-webpack/package.json').version
// Initial landing page
document.write(`
<h1>Hello world!</h1>
<p>
You are using Node.js ${process.versions.node},
Chromium ${process.versions.chrome},
Electron ${process.versions.electron},
and <code>electron-webpack</code> ${require('electron-webpack/package.json').version}.
</p>
`)

0 comments on commit 3a5914f

Please sign in to comment.