Skip to content

Commit a265654

Browse files
committed
Getting started with electron 1.x
1 parent 32b4d00 commit a265654

6 files changed

Lines changed: 65 additions & 0 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Getting Started with Electron 1.x
2+
3+
> [https://youtu.be/jKzBJAowmGg](https://youtu.be/jKzBJAowmGg)
4+
5+
* Install [Node.js](https://nodejs.org/).
6+
* Install dependencies: `npm install`
7+
* Then run `npm start` to open the desktop application.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Document</title>
6+
</head>
7+
<body>
8+
I'm bear a html file!
9+
</body>
10+
</html>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Document</title>
6+
</head>
7+
<body>
8+
<h1>Grrr!</h1>
9+
<script>require('./index.js')</script>
10+
</body>
11+
</html>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
const remote = require('electron').remote
3+
const main = remote.require('./main.js')
4+
5+
var button = document.createElement('button')
6+
button.textContent = 'Open Window'
7+
button.addEventListener('click', () => {
8+
main.openWindow()
9+
}, false)
10+
document.body.appendChild(button)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const electron = require('electron')
2+
const {app, BrowserWindow} = electron
3+
4+
app.on('ready', () => {
5+
let win = new BrowserWindow({width:800, height: 600})
6+
win.loadURL(`file://${__dirname}/index.html`)
7+
win.webContents.openDevTools()
8+
})
9+
10+
exports.openWindow = () => {
11+
let win = new BrowserWindow({width:400, height: 200})
12+
win.loadURL(`file://${__dirname}/bear.html`)
13+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "getting-started-with-electron-1.0",
3+
"version": "0.1.0",
4+
"description": "",
5+
"main": "main.js",
6+
"scripts": {
7+
"start": "electron main.js"
8+
},
9+
"author": "Kyle Robinson Young <kyle@dontkry.com> (http://dontkry.com)",
10+
"license": "MIT",
11+
"devDependencies": {
12+
"electron-prebuilt": "^1.2.5"
13+
}
14+
}

0 commit comments

Comments
 (0)