forked from hokein/electron-sample-apps
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request hokein#30 from hokein/electron-v1
Update to Electron v1.1.1.
- Loading branch information
Showing
261 changed files
with
781 additions
and
858 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,27 @@ | ||
var app = require('app'); // Module to control application life. | ||
var BrowserWindow = require('browser-window'); // Module to create native browser window. | ||
|
||
// Report crashes to our server. | ||
require('crash-reporter').start(); | ||
|
||
// Keep a global reference of the window object, if you don't, the window will | ||
// be closed automatically when the javascript object is GCed. | ||
var mainWindow = null; | ||
|
||
// Quit when all windows are closed. | ||
app.on('window-all-closed', function() { | ||
if (process.platform != 'darwin') | ||
app.quit(); | ||
}); | ||
|
||
// This method will be called when Electron has done everything | ||
// initialization and ready for creating browser windows. | ||
app.on('ready', function() { | ||
// 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'); | ||
|
||
// 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; | ||
}); | ||
}); | ||
const {app, BrowserWindow} = require('electron'); | ||
|
||
let mainWindow; | ||
|
||
// Quit when all windows are closed. | ||
app.on('window-all-closed', function() { | ||
if (process.platform != 'darwin') | ||
app.quit(); | ||
}); | ||
|
||
// This method will be called when Electron has done everything | ||
// initialization and ready for creating browser windows. | ||
app.on('ready', function() { | ||
// 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'); | ||
|
||
// 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; | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name" : "camera-demo", | ||
"version" : "0.1.0", | ||
"version" : "1.1.0", | ||
"main" : "main.js" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,20 @@ | ||
var app = require('app'); | ||
var BrowserWindow = require('browser-window'); | ||
|
||
var mainWindow = null; | ||
|
||
app.on('window-all-closed', function() { | ||
if (process.platform != 'darwin') | ||
app.quit(); | ||
}); | ||
|
||
//app.commandLine.appendSwitch('client-certificate', | ||
//'X:\\workspace\\client-certificates\\ssl\\client.crt'); | ||
|
||
app.on('ready', function() { | ||
mainWindow = new BrowserWindow({ | ||
'width': 800, | ||
'height': 600, | ||
}); | ||
|
||
mainWindow.loadUrl('https://localhost:5000'); | ||
}); | ||
const {app, BrowserWindow} = require('electron'); | ||
|
||
let mainWindow; | ||
|
||
app.on('window-all-closed', function() { | ||
if (process.platform != 'darwin') | ||
app.quit(); | ||
}); | ||
|
||
//app.commandLine.appendSwitch('client-certificate', | ||
//'path/to/client-certificates/ssl/client.crt'); | ||
|
||
app.on('ready', function() { | ||
mainWindow = new BrowserWindow({ | ||
'width': 800, | ||
'height': 600, | ||
}); | ||
|
||
mainWindow.loadURL('https://localhost:5000'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name" : "client-certificate-demo", | ||
"version" : "0.1.0", | ||
"main" : "main.js" | ||
} | ||
{ | ||
"name" : "client-certificate-demo", | ||
"version" : "1.1.0", | ||
"main" : "main.js" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
var https = require('https'); | ||
var fs = require('fs'); | ||
|
||
var options = { | ||
key: fs.readFileSync('ssl/server.key'), | ||
cert: fs.readFileSync('ssl/server.crt'), | ||
ca: fs.readFileSync('ssl/rootCA.crt'), | ||
requestCert: true, | ||
rejectUnauthorized: false | ||
}; | ||
|
||
https.createServer(options, function (req, res) { | ||
console.log('Receive a request.'); | ||
if (req.client.authorized) { | ||
res.writeHead(200); | ||
res.end('approved\n'); | ||
} else { | ||
res.writeHead(401); | ||
res.end('denied\n'); | ||
} | ||
}).listen(5000); | ||
const https = require('https'); | ||
const fs = require('fs'); | ||
|
||
const options = { | ||
key: fs.readFileSync('ssl/server.key'), | ||
cert: fs.readFileSync('ssl/server.crt'), | ||
ca: fs.readFileSync('ssl/rootCA.crt'), | ||
requestCert: true, | ||
rejectUnauthorized: false | ||
}; | ||
|
||
https.createServer(options, function (req, res) { | ||
console.log('Receive a request.'); | ||
if (req.client.authorized) { | ||
res.writeHead(200); | ||
res.end('approved\n'); | ||
} else { | ||
res.writeHead(401); | ||
res.end('denied\n'); | ||
} | ||
}).listen(5000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
var app = require('app'); | ||
var BrowserWindow = require('browser-window'); | ||
const {app, BrowserWindow} = require('electron'); | ||
|
||
let mainWindow; | ||
|
||
var mainWindow = null; | ||
app.on('ready', function() { | ||
mainWindow = new BrowserWindow({width: 400, height: 360}); | ||
mainWindow.loadUrl('file://' + __dirname + '/manager.html'); | ||
mainWindow.loadURL('file://' + __dirname + '/manager.html'); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name" : "cookies-demo", | ||
"version" : "0.1.0", | ||
"version" : "1.1.0", | ||
"main" : "main.js" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
# Cookies | ||
|
||
A sample app allows you to manipulate your cookies data using [cookies]( | ||
https://github.com/atom/electron/blob/master/docs/api/browser-window.md#sessioncookies) API. | ||
A sample app allows you to manipulate your cookies data using [cookies][1] API. | ||
|
||
## APIs | ||
|
||
[Session.cookies](https://github.com/atom/electron/blob/master/docs/api/browser-window.md#sessioncookies) | ||
[Session.cookies][1] | ||
|
||
## Screenshot | ||
|
||
 | ||
|
||
[1]: https://github.com/electron/electron/blob/master/docs/api/session.md#sescookies |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,25 @@ | ||
var app = require('app'); | ||
var BrowserWindow = require('browser-window'); | ||
var http = require('http'); | ||
var crashReporter = require('crash-reporter'); | ||
crashReporter.start({submitUrl: 'http://127.0.0.1:9999'}); | ||
|
||
function getRandomInt(min, max) { | ||
return Math.floor(Math.random() * (max - min)) + min; | ||
} | ||
|
||
// Crash-report collection server | ||
var server = http.createServer(function(req, res) { | ||
// Handle the uploaded crash report from client here | ||
// ... | ||
// Response the crash report id on server to client. | ||
res.end(getRandomInt(1000, 9999).toString()); | ||
}); | ||
|
||
var mainWindow = null; | ||
app.on('ready', function() { | ||
server.listen(9999, '127.0.0.1', function () { | ||
mainWindow = new BrowserWindow({width: 800, height: 600}); | ||
mainWindow.loadUrl('file://' + __dirname + '/index.html'); | ||
mainWindow.toggleDevTools(); | ||
}); | ||
}); | ||
const {app, BrowserWindow, crashReporter} = require('electron'); | ||
const http = require('http'); | ||
|
||
crashReporter.start({submitURL: 'http://127.0.0.1:9999', companyName: 'sample'}); | ||
|
||
function getRandomInt(min, max) { | ||
return Math.floor(Math.random() * (max - min)) + min; | ||
} | ||
|
||
// Crash-report collection server | ||
var server = http.createServer(function(req, res) { | ||
// Handle the uploaded crash report from client here | ||
// ... | ||
// Response the crash report id on server to client. | ||
res.end(getRandomInt(1000, 9999).toString()); | ||
}); | ||
|
||
var mainWindow = null; | ||
app.on('ready', function() { | ||
server.listen(9999, '127.0.0.1', function () { | ||
mainWindow = new BrowserWindow({width: 800, height: 600}); | ||
mainWindow.loadURL('file://' + __dirname + '/index.html'); | ||
mainWindow.toggleDevTools(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name" : "crash-report-demo", | ||
"version" : "0.1.0", | ||
"version" : "1.1.0", | ||
"main" : "main.js" | ||
} |
Oops, something went wrong.