Merge branch 'update-code-samples' of https://github.com/stevekinney/electron into stevekinney-update-code-samples

This commit is contained in:
Cheng Zhao 2016-05-05 20:55:25 +09:00
commit 969a30fc3b
38 changed files with 258 additions and 252 deletions

View file

@ -6,8 +6,8 @@ The following example shows how to quit the application when the last window is
closed:
```javascript
const app = require('electron').app;
app.on('window-all-closed', function() {
const { app } = require('electron');
app.on('window-all-closed', () => {
app.quit();
});
```
@ -237,7 +237,7 @@ should prevent the default behavior with `event.preventDefault()` and call
`callback(username, password)` with the credentials.
```javascript
app.on('login', function(event, webContents, request, authInfo, callback) {
app.on('login', (event, webContents, request, authInfo, callback) => {
event.preventDefault();
callback('username', 'secret');
})
@ -481,9 +481,9 @@ An example of activating the window of primary instance when a second instance
starts:
```javascript
var myWindow = null;
let myWindow = null;
var shouldQuit = app.makeSingleInstance(function(commandLine, workingDirectory) {
const shouldQuit = app.makeSingleInstance((commandLine, workingDirectory) => {
// Someone tried to run a second instance, we should focus our window.
if (myWindow) {
if (myWindow.isMinimized()) myWindow.restore();
@ -497,7 +497,7 @@ if (shouldQuit) {
}
// Create myWindow, load the rest of the app, etc...
app.on('ready', function() {
app.on('ready', () => {
});
```