From 13b6ed6dc527e765267adf9b9477df728c0a650e Mon Sep 17 00:00:00 2001 From: Thomas Tuts Date: Tue, 9 Jun 2015 16:49:21 +0200 Subject: [PATCH 01/18] Fix several typos and grammar errors --- docs/api/browser-window.md | 2 +- docs/api/frameless-window.md | 2 +- docs/api/global-shortcut.md | 2 +- docs/tutorial/application-distribution.md | 2 +- docs/tutorial/desktop-environment-integration.md | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index e60a7d227995..858877ebc8a8 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -753,7 +753,7 @@ Calling `event.preventDefault()` can prevent creating new windows. Emitted when user or the page wants to start an navigation, it can happen when `window.location` object is changed or user clicks a link in the page. -This event will not emit when the navigation is started programmely with APIs +This event will not emit when the navigation is started programmatically with APIs like `WebContents.loadUrl` and `WebContents.back`. Calling `event.preventDefault()` can prevent the navigation. diff --git a/docs/api/frameless-window.md b/docs/api/frameless-window.md index fe3b33388d9b..498a65b225db 100644 --- a/docs/api/frameless-window.md +++ b/docs/api/frameless-window.md @@ -28,7 +28,7 @@ var win = new BrowserWindow({ transparent: true, frame: false }); API to set window shape to solve this, but currently blocked at an [upstream bug](https://code.google.com/p/chromium/issues/detail?id=387234). * Transparent window is not resizable, setting `resizable` to `true` may make - transprent window stop working on some platforms. + transparent window stop working on some platforms. * The `blur` filter only applies to the web page, so there is no way to apply blur effect to the content below the window. * On Windows transparent window will not work when DWM is disabled. diff --git a/docs/api/global-shortcut.md b/docs/api/global-shortcut.md index 2d27398aae4b..e48519b96e72 100644 --- a/docs/api/global-shortcut.md +++ b/docs/api/global-shortcut.md @@ -10,7 +10,7 @@ var globalShortcut = require('global-shortcut'); // Register a 'ctrl+x' shortcut listener. var ret = globalShortcut.register('ctrl+x', function() { console.log('ctrl+x is pressed'); }) if (!ret) - console.log('registerion fails'); + console.log('registration failed'); // Check whether a shortcut is registered. console.log(globalShortcut.isRegistered('ctrl+x')); diff --git a/docs/tutorial/application-distribution.md b/docs/tutorial/application-distribution.md index 5c76f14d504a..c96a53bcbeee 100644 --- a/docs/tutorial/application-distribution.md +++ b/docs/tutorial/application-distribution.md @@ -35,7 +35,7 @@ exposing your app's source code to users. To use an `asar` archive to replace the `app` folder, you need to rename the archive to `app.asar`, and put it under Electron's resources directory like -bellow, and Electron will then try read the archive and start from it. +below, and Electron will then try read the archive and start from it. On OS X: diff --git a/docs/tutorial/desktop-environment-integration.md b/docs/tutorial/desktop-environment-integration.md index 3f65df234dfe..b67b252f4d5b 100644 --- a/docs/tutorial/desktop-environment-integration.md +++ b/docs/tutorial/desktop-environment-integration.md @@ -149,8 +149,8 @@ On Windows, a taskbar button can be used to display a progress bar. This enables a window to provide progress information to the user without that user having to switch to the window itself. -The Unity DE also has a simililar feature that allows you to specify progress -bar in the lancher. +The Unity DE also has a similar feature that allows you to specify the progress +bar in the launcher. __Progress bar in taskbar button:__ From 8893c9502aaedd08e80f488cd73d467e62768864 Mon Sep 17 00:00:00 2001 From: Thomas Tuts Date: Tue, 9 Jun 2015 16:49:44 +0200 Subject: [PATCH 02/18] Use consistent naming convention for 'task bar' concept --- docs/api/browser-window.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index 858877ebc8a8..ca2638b6bb80 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -43,7 +43,7 @@ You can also create a window without chrome by using other windows * `fullscreen` Boolean - Whether the window should show in fullscreen, when set to `false` the fullscreen button would also be hidden on OS X - * `skip-taskbar` Boolean - Do not show window in Taskbar + * `skip-taskbar` Boolean - Do not show window in taskbar * `zoom-factor` Number - The default zoom factor of the page, zoom factor is zoom percent / 100, so `3.0` represents `300%` * `kiosk` Boolean - The kiosk mode @@ -464,7 +464,7 @@ Starts or stops flashing the window to attract user's attention. * `skip` Boolean -Makes the window do not show in Taskbar. +Makes the window not show in the taskbar. ### BrowserWindow.setKiosk(flag) @@ -604,12 +604,12 @@ it will assume `app.getName().desktop`. ### BrowserWindow.setOverlayIcon(overlay, description) * `overlay` [NativeImage](native-image.md) - the icon to display on the bottom -right corner of the Taskbar icon. If this parameter is `null`, the overlay is +right corner of the taskbar icon. If this parameter is `null`, the overlay is cleared * `description` String - a description that will be provided to Accessibility screen readers -Sets a 16px overlay onto the current Taskbar icon, usually used to convey some sort of application status or to passively notify the user. +Sets a 16px overlay onto the current taskbar icon, usually used to convey some sort of application status or to passively notify the user. __Note:__ This API is only available on Windows, Win7 or above From 6494ed6b13d96c4417d48e1afa08bed332c80be0 Mon Sep 17 00:00:00 2001 From: Thomas Tuts Date: Tue, 9 Jun 2015 16:51:54 +0200 Subject: [PATCH 03/18] Make platform compatibility notes consistent --- docs/api/browser-window.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index ca2638b6bb80..6358e15e1c18 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -483,13 +483,13 @@ Returns whether the window is in kiosk mode. Sets the pathname of the file the window represents, and the icon of the file will show in window's title bar. -__Note__: This API is available only on OS X. +__Note__: This API is only available on OS X. ### BrowserWindow.getRepresentedFilename() Returns the pathname of the file the window represents. -__Note__: This API is available only on OS X. +__Note__: This API is only available on OS X. ### BrowserWindow.setDocumentEdited(edited) @@ -498,13 +498,13 @@ __Note__: This API is available only on OS X. Specifies whether the window’s document has been edited, and the icon in title bar will become grey when set to `true`. -__Note__: This API is available only on OS X. +__Note__: This API is only available on OS X. ### BrowserWindow.IsDocumentEdited() Whether the window's document has been edited. -__Note__: This API is available only on OS X. +__Note__: This API is only available on OS X. ### BrowserWindow.openDevTools([options]) @@ -611,13 +611,13 @@ screen readers Sets a 16px overlay onto the current taskbar icon, usually used to convey some sort of application status or to passively notify the user. -__Note:__ This API is only available on Windows, Win7 or above +__Note:__ This API is only available on Windows (Windows 7 and above) ### BrowserWindow.showDefinitionForSelection() Shows pop-up dictionary that searches the selected word on the page. -__Note__: This API is available only on OS X. +__Note__: This API is only available on OS X. ### BrowserWindow.setAutoHideMenuBar(hide) From ab98dcd7cf30f80135f997a131c0562dbb656f08 Mon Sep 17 00:00:00 2001 From: Thomas Tuts Date: Tue, 9 Jun 2015 16:56:45 +0200 Subject: [PATCH 04/18] Try to clarify docs for window.onbeforeunload() --- docs/api/browser-window.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index 6358e15e1c18..4211ac8020fd 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -131,9 +131,9 @@ window.onbeforeunload = function(e) { console.log('I do not want to be closed'); // Unlike usual browsers, in which a string should be returned and the user is - // prompted to confirm the page unload. Electron gives the power completely - // to the developers, return empty string or false would prevent the unloading - // now. You can also use the dialog API to let user confirm it. + // prompted to confirm the page unload, Electron gives developers more options. + // Returning empty string or false would prevent the unloading now. + // You can also use the dialog API to let the user confirm closing the application. return false; }; ``` From 29abfa68e91c36465441cff0a5d0b08e5ed2376e Mon Sep 17 00:00:00 2001 From: Thomas Tuts Date: Tue, 9 Jun 2015 16:59:14 +0200 Subject: [PATCH 05/18] Fix grammar and JS example for Chrome command line switches docs --- docs/api/chrome-command-line-switches.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/api/chrome-command-line-switches.md b/docs/api/chrome-command-line-switches.md index 2ea1a29fb86f..84057129bc5c 100644 --- a/docs/api/chrome-command-line-switches.md +++ b/docs/api/chrome-command-line-switches.md @@ -1,6 +1,6 @@ # Supported Chrome command line switches -Following command lines switches in Chrome browser are also Supported in +The following command lines switches in Chrome browser are also supported in Electron, you can use [app.commandLine.appendSwitch][append-switch] to append them in your app's main script before the [ready][ready] event of [app][app] module is emitted: @@ -11,6 +11,7 @@ app.commandLine.appendSwitch('remote-debugging-port', '8315'); app.commandLine.appendSwitch('host-rules', 'MAP * 127.0.0.1'); app.on('ready', function() { + // Your code here }); ``` From 6d756d9d13c66426562ea1f5c93c9e8c711ff864 Mon Sep 17 00:00:00 2001 From: Thomas Tuts Date: Tue, 9 Jun 2015 17:59:53 +0200 Subject: [PATCH 06/18] Remove trailing commas from dialog filters code example --- docs/api/dialog.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/api/dialog.md b/docs/api/dialog.md index 05b8650a0198..f8058649ae57 100644 --- a/docs/api/dialog.md +++ b/docs/api/dialog.md @@ -36,8 +36,8 @@ selected, an example is: filters: [ { name: 'Images', extensions: ['jpg', 'png', 'gif'] }, { name: 'Movies', extensions: ['mkv', 'avi', 'mp4'] }, - { name: 'Custom File Type', extensions: ['as'] }, - ], + { name: 'Custom File Type', extensions: ['as'] } + ] } ``` From e829a289475366e1a5b9c87e1281333c73837d92 Mon Sep 17 00:00:00 2001 From: Thomas Tuts Date: Tue, 9 Jun 2015 18:01:09 +0200 Subject: [PATCH 07/18] Clean up code in global shortcut code example --- docs/api/global-shortcut.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/api/global-shortcut.md b/docs/api/global-shortcut.md index e48519b96e72..871357f89f9f 100644 --- a/docs/api/global-shortcut.md +++ b/docs/api/global-shortcut.md @@ -9,8 +9,10 @@ var globalShortcut = require('global-shortcut'); // Register a 'ctrl+x' shortcut listener. var ret = globalShortcut.register('ctrl+x', function() { console.log('ctrl+x is pressed'); }) -if (!ret) + +if (!ret) { console.log('registration failed'); +} // Check whether a shortcut is registered. console.log(globalShortcut.isRegistered('ctrl+x')); From cf79f439ce625144ede7e422b4b047b1266528e4 Mon Sep 17 00:00:00 2001 From: Thomas Tuts Date: Tue, 9 Jun 2015 18:08:02 +0200 Subject: [PATCH 08/18] Remove trailing commas in menu docs --- docs/api/menu.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/api/menu.md b/docs/api/menu.md index 60e37884e352..8da093901d48 100644 --- a/docs/api/menu.md +++ b/docs/api/menu.md @@ -70,7 +70,7 @@ var template = [ label: 'Quit', accelerator: 'Command+Q', click: function() { app.quit(); } - }, + } ] }, { @@ -108,7 +108,7 @@ var template = [ label: 'Select All', accelerator: 'Command+A', selector: 'selectAll:' - }, + } ] }, { @@ -123,7 +123,7 @@ var template = [ label: 'Toggle DevTools', accelerator: 'Alt+Command+I', click: function() { BrowserWindow.getFocusedWindow().toggleDevTools(); } - }, + } ] }, { @@ -145,13 +145,13 @@ var template = [ { label: 'Bring All to Front', selector: 'arrangeInFront:' - }, + } ] }, { label: 'Help', submenu: [] - }, + } ]; menu = Menu.buildFromTemplate(template); From bd1fd9680f43493d564913006d330e89a1404ab5 Mon Sep 17 00:00:00 2001 From: Thomas Tuts Date: Tue, 9 Jun 2015 18:08:27 +0200 Subject: [PATCH 09/18] Add missing commas in menu docs --- docs/api/menu.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/api/menu.md b/docs/api/menu.md index 8da093901d48..461bfbb43de4 100644 --- a/docs/api/menu.md +++ b/docs/api/menu.md @@ -281,10 +281,10 @@ Template: ```javascript [ - {label: '4', id: '4'} - {label: '5', id: '5'} - {label: '1', id: '1', position: 'before=4'} - {label: '2', id: '2'} + {label: '4', id: '4'}, + {label: '5', id: '5'}, + {label: '1', id: '1', position: 'before=4'}, + {label: '2', id: '2'}, {label: '3', id: '3'} ] ``` @@ -303,11 +303,11 @@ Template: ```javascript [ - {label: 'a', position: 'endof=letters'} - {label: '1', position: 'endof=numbers'} - {label: 'b', position: 'endof=letters'} - {label: '2', position: 'endof=numbers'} - {label: 'c', position: 'endof=letters'} + {label: 'a', position: 'endof=letters'}, + {label: '1', position: 'endof=numbers'}, + {label: 'b', position: 'endof=letters'}, + {label: '2', position: 'endof=numbers'}, + {label: 'c', position: 'endof=letters'}, {label: '3', position: 'endof=numbers'} ] ``` From 2f4333b852a72558f2401f3a2272a2fd46353481 Mon Sep 17 00:00:00 2001 From: Thomas Tuts Date: Tue, 9 Jun 2015 18:10:02 +0200 Subject: [PATCH 10/18] Declare one variable per statement in protocol code example --- docs/api/protocol.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/api/protocol.md b/docs/api/protocol.md index 65554e052105..181a2e57f733 100644 --- a/docs/api/protocol.md +++ b/docs/api/protocol.md @@ -7,8 +7,8 @@ An example of implementing a protocol that has the same effect with the `file://` protocol: ```javascript -var app = require('app'), - path = require('path'); +var app = require('app'); +var path = require('path'); app.on('ready', function() { var protocol = require('protocol'); From 35dcdfc49239fcd954141b88f8eb3173b545b367 Mon Sep 17 00:00:00 2001 From: Thomas Tuts Date: Tue, 9 Jun 2015 18:11:40 +0200 Subject: [PATCH 11/18] Remove trailing comma in tray code example --- docs/api/tray.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/tray.md b/docs/api/tray.md index d85ac1a1dac8..3be241dde9a2 100644 --- a/docs/api/tray.md +++ b/docs/api/tray.md @@ -15,7 +15,7 @@ app.on('ready', function(){ { label: 'Item1', type: 'radio' }, { label: 'Item2', type: 'radio' }, { label: 'Item3', type: 'radio', checked: true }, - { label: 'Item4', type: 'radio' }, + { label: 'Item4', type: 'radio' } ]); appIcon.setToolTip('This is my application.'); appIcon.setContextMenu(contextMenu); From a84e6227efd0beb3b5d9de0c287cace0839ddec0 Mon Sep 17 00:00:00 2001 From: Thomas Tuts Date: Tue, 9 Jun 2015 18:12:34 +0200 Subject: [PATCH 12/18] Remove obsolete space in console log when using multiple arguments --- docs/api/web-view-tag.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/web-view-tag.md b/docs/api/web-view-tag.md index 705014cf6a18..1198f212e25f 100644 --- a/docs/api/web-view-tag.md +++ b/docs/api/web-view-tag.md @@ -390,7 +390,7 @@ without regard for log level or other properties. ```javascript webview.addEventListener('console-message', function(e) { - console.log('Guest page logged a message: ', e.message); + console.log('Guest page logged a message:', e.message); }); ``` From 9199d0df0af8078dda7ff929860f7580565a8752 Mon Sep 17 00:00:00 2001 From: Thomas Tuts Date: Tue, 9 Jun 2015 18:14:06 +0200 Subject: [PATCH 13/18] Add missing semicolon in webview tag documentation --- docs/api/web-view-tag.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/web-view-tag.md b/docs/api/web-view-tag.md index 1198f212e25f..cbbd6205c391 100644 --- a/docs/api/web-view-tag.md +++ b/docs/api/web-view-tag.md @@ -448,7 +448,7 @@ webview.send('ping'); var ipc = require('ipc'); ipc.on('ping', function() { ipc.sendToHost('pong'); -}) +}); ``` ### crashed From b4790a753133fce66a430f4d1613d4ca05674988 Mon Sep 17 00:00:00 2001 From: Thomas Tuts Date: Tue, 9 Jun 2015 18:15:30 +0200 Subject: [PATCH 14/18] Remove trailing commas in desktop environment docs --- docs/tutorial/desktop-environment-integration.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/tutorial/desktop-environment-integration.md b/docs/tutorial/desktop-environment-integration.md index b67b252f4d5b..5dee6fdf4ec3 100644 --- a/docs/tutorial/desktop-environment-integration.md +++ b/docs/tutorial/desktop-environment-integration.md @@ -70,9 +70,9 @@ var dockMenu = Menu.buildFromTemplate([ { label: 'New Window', click: function() { console.log('New Window'); } }, { label: 'New Window with Settings', submenu: [ { label: 'Basic' }, - { label: 'Pro'}, + { label: 'Pro'} ]}, - { label: 'New Command...'}, + { label: 'New Command...'} ]); app.dock.setMenu(dockMenu); ``` @@ -119,7 +119,7 @@ app.setUserTasks([ iconPath: process.execPath, iconIndex: 0, title: 'New Window', - description: 'Create a new window', + description: 'Create a new window' } ]); ``` From a6a5d50c3fd3a686b9b385b826547f4d8542be3e Mon Sep 17 00:00:00 2001 From: Thomas Tuts Date: Tue, 9 Jun 2015 18:15:54 +0200 Subject: [PATCH 15/18] Add missing semicolons in devtools extension docs --- docs/tutorial/devtools-extension.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/tutorial/devtools-extension.md b/docs/tutorial/devtools-extension.md index e93013d6ed19..731de4e13f8b 100644 --- a/docs/tutorial/devtools-extension.md +++ b/docs/tutorial/devtools-extension.md @@ -20,14 +20,14 @@ Then you can load the extension in Electron by opening devtools in any window, and then running the following code in the devtools console: ```javascript -require('remote').require('browser-window').addDevToolsExtension('/some-directory/react-devtools') +require('remote').require('browser-window').addDevToolsExtension('/some-directory/react-devtools'); ``` To unload the extension, you can call `BrowserWindow.removeDevToolsExtension` API with its name and it will not load the next time you open the devtools: ```javascript -require('remote').require('browser-window').removeDevToolsExtension('React Developer Tools') +require('remote').require('browser-window').removeDevToolsExtension('React Developer Tools'); ``` ## Format of devtools extension From 464263067403f9607f2f1218a5bf5ad6d0a272ae Mon Sep 17 00:00:00 2001 From: Thomas Tuts Date: Tue, 9 Jun 2015 18:17:12 +0200 Subject: [PATCH 16/18] Replace shorthand if-statement notation in quick start docs --- docs/tutorial/quick-start.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/tutorial/quick-start.md b/docs/tutorial/quick-start.md index 073d2ee40c95..644793f62378 100644 --- a/docs/tutorial/quick-start.md +++ b/docs/tutorial/quick-start.md @@ -82,8 +82,9 @@ var mainWindow = null; // Quit when all windows are closed. app.on('window-all-closed', function() { - if (process.platform != 'darwin') + if (process.platform != 'darwin') { app.quit(); + } }); // This method will be called when Electron has done everything From c78a3ff7149e48f3506a4b4f316fbaabbca1960d Mon Sep 17 00:00:00 2001 From: Thomas Tuts Date: Tue, 9 Jun 2015 18:17:38 +0200 Subject: [PATCH 17/18] Replace shorthand if-statement notation in Pepper Flash docs --- docs/tutorial/using-pepper-flash-plugin.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/tutorial/using-pepper-flash-plugin.md b/docs/tutorial/using-pepper-flash-plugin.md index bbb37862da44..20b29c4114a9 100644 --- a/docs/tutorial/using-pepper-flash-plugin.md +++ b/docs/tutorial/using-pepper-flash-plugin.md @@ -23,8 +23,9 @@ var mainWindow = null; // Quit when all windows are closed. app.on('window-all-closed', function() { - if (process.platform != 'darwin') + if (process.platform != 'darwin') { app.quit(); + } }); // Specify flash path. From d8cd9b71b06eb9690de79cb75bfb1fed758568b9 Mon Sep 17 00:00:00 2001 From: Thomas Tuts Date: Tue, 9 Jun 2015 18:18:47 +0200 Subject: [PATCH 18/18] Clean up Selenium webdriver code example --- docs/tutorial/using-selenium-and-webdriver.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/tutorial/using-selenium-and-webdriver.md b/docs/tutorial/using-selenium-and-webdriver.md index cda69c0d6184..13934c01b086 100644 --- a/docs/tutorial/using-selenium-and-webdriver.md +++ b/docs/tutorial/using-selenium-and-webdriver.md @@ -49,14 +49,14 @@ and where to find Electron's binary: ```javascript var webdriver = require('selenium-webdriver'); -var driver = new webdriver.Builder(). - // The "9515" is the port opened by chrome driver. - usingServer('http://localhost:9515'). - withCapabilities({chromeOptions: { - // Here is the path to your Electron binary. - binary: '/Path-to-Your-App.app/Contents/MacOS/Atom'}}). - forBrowser('electron'). - build(); +var driver = new webdriver.Builder() + // The "9515" is the port opened by chrome driver. + .usingServer('http://localhost:9515') + .withCapabilities({chromeOptions: { + // Here is the path to your Electron binary. + binary: '/Path-to-Your-App.app/Contents/MacOS/Atom'}}) + .forBrowser('electron') + .build(); driver.get('http://www.google.com'); driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');