📝 Fix coding style issues

* Adjust line length to `80`
* Normalize whitespaces

[ci skip]
This commit is contained in:
Plusb Preco 2016-04-22 22:53:26 +09:00
parent 0282180b9c
commit 4f4277e25e
20 changed files with 73 additions and 54 deletions

View file

@ -523,8 +523,8 @@ This method returns `true` if the system is in Dark Mode, and `false` otherwise.
* `result` Integer - Result of import. * `result` Integer - Result of import.
Imports the certificate in pkcs12 format into the platform certificate store. Imports the certificate in pkcs12 format into the platform certificate store.
`callback` is called with the `result` of import operation, a value of `0` indicates `callback` is called with the `result` of import operation, a value of `0`
success while any other value indicates failure according to chromium [net_error_list](https://code.google.com/p/chromium/codesearch#chromium/src/net/base/net_error_list.h). indicates success while any other value indicates failure according to chromium [net_error_list](https://code.google.com/p/chromium/codesearch#chromium/src/net/base/net_error_list.h).
### `app.commandLine.appendSwitch(switch[, value])` ### `app.commandLine.appendSwitch(switch[, value])`

View file

@ -5,8 +5,11 @@ This module provides an interface for the `Squirrel` auto-updater framework.
You can quickly launch a multi-platform release server for distributing your You can quickly launch a multi-platform release server for distributing your
application by using one of these projects: application by using one of these projects:
- [electron-release-server][electron-release-server]: *A fully featured, self-hosted release server for electron applications, compatible with auto-updater* - [electron-release-server][electron-release-server]: *A fully featured,
- [squirrel-updates-server][squirrel-updates-server]: *A simple node.js server for Squirrel.Mac and Squirrel.Windows which uses GitHub releases* self-hosted release server for electron applications, compatible with
auto-updater*
- [squirrel-updates-server][squirrel-updates-server]: *A simple node.js server
for Squirrel.Mac and Squirrel.Windows which uses GitHub releases*
## Platform notices ## Platform notices

View file

@ -311,7 +311,8 @@ Emitted when an [App Command](https://msdn.microsoft.com/en-us/library/windows/d
is invoked. These are typically related to keyboard media keys or browser is invoked. These are typically related to keyboard media keys or browser
commands, as well as the "Back" button built into some mice on Windows. commands, as well as the "Back" button built into some mice on Windows.
Commands are lowercased with underscores replaced with hyphens and the `APPCOMMAND_` prefix stripped off. Commands are lowercased with underscores replaced with hyphens and the
`APPCOMMAND_` prefix stripped off.
e.g. `APPCOMMAND_BROWSER_BACKWARD` is emitted as `browser-backward`. e.g. `APPCOMMAND_BROWSER_BACKWARD` is emitted as `browser-backward`.
```js ```js
@ -677,9 +678,9 @@ window.
### `win.setSheetOffset(offset)` ### `win.setSheetOffset(offset)`
Changes the attachment point for sheets on Mac OS X. By default, sheets are attached Changes the attachment point for sheets on Mac OS X. By default, sheets are
just below the window frame, but you may want to display them beneath a HTML-rendered attached just below the window frame, but you may want to display them beneath
toolbar. For example: a HTML-rendered toolbar. For example:
``` ```
var toolbarRect = document.getElementById('toolbar').getBoundingClientRect(); var toolbarRect = document.getElementById('toolbar').getBoundingClientRect();
@ -823,8 +824,8 @@ cleared
* `description` String - a description that will be provided to Accessibility * `description` String - a description that will be provided to Accessibility
screen readers screen readers
Sets a 16 x 16 pixel overlay onto the current taskbar icon, usually used to convey some Sets a 16 x 16 pixel overlay onto the current taskbar icon, usually used to
sort of application status or to passively notify the user. convey some sort of application status or to passively notify the user.
### `win.setHasShadow(hasShadow)` _OS X_ ### `win.setHasShadow(hasShadow)` _OS X_

View file

@ -60,7 +60,8 @@ ID.
## crash-reporter Payload ## crash-reporter Payload
The crash reporter will send the following data to the `submitURL` as a `multipart/form-data` `POST`: The crash reporter will send the following data to the `submitURL` as
a `multipart/form-data` `POST`:
* `ver` String - The version of Electron. * `ver` String - The version of Electron.
* `platform` String - e.g. 'win32'. * `platform` String - e.g. 'win32'.

View file

@ -12,7 +12,8 @@ const dialog = require('electron').dialog;
console.log(dialog.showOpenDialog({ properties: [ 'openFile', 'openDirectory', 'multiSelections' ]})); console.log(dialog.showOpenDialog({ properties: [ 'openFile', 'openDirectory', 'multiSelections' ]}));
``` ```
The Dialog is opened from Electron's main thread. If you want to use the dialog object from a renderer process, remember to access it using the remote: The Dialog is opened from Electron's main thread. If you want to use the dialog
object from a renderer process, remember to access it using the remote:
```javascript ```javascript
const dialog = require('electron').remote.dialog; const dialog = require('electron').remote.dialog;

View file

@ -1,6 +1,9 @@
# Frameless Window # Frameless Window
A frameless window is a window that has no [chrome](https://developer.mozilla.org/en-US/docs/Glossary/Chrome), the parts of the window, like toolbars, that are not a part of the web page. These are options on the [`BrowserWindow`](browser-window.md) class. A frameless window is a window that has no
[chrome](https://developer.mozilla.org/en-US/docs/Glossary/Chrome), the parts of
the window, like toolbars, that are not a part of the web page. These are
options on the [`BrowserWindow`](browser-window.md) class.
## Create a frameless window ## Create a frameless window
@ -38,7 +41,8 @@ var win = new BrowserWindow({ transparent: true, frame: false });
### Limitations ### Limitations
* You can not click through the transparent area. We are going to introduce an * You can not click through the transparent area. We are going to introduce an
API to set window shape to solve this, see [our issue](https://github.com/electron/electron/issues/1335) for details. API to set window shape to solve this, see
[our issue](https://github.com/electron/electron/issues/1335) for details.
* Transparent windows are not resizable. Setting `resizable` to `true` may make * Transparent windows are not resizable. Setting `resizable` to `true` may make
a transparent window stop working on some platforms. a transparent window stop working on some platforms.
* The `blur` filter only applies to the web page, so there is no way to apply * The `blur` filter only applies to the web page, so there is no way to apply

View file

@ -22,9 +22,10 @@ Create a new `MenuItem` with the following method:
* `sublabel` String * `sublabel` String
* `accelerator` [Accelerator](accelerator.md) * `accelerator` [Accelerator](accelerator.md)
* `icon` [NativeImage](native-image.md) * `icon` [NativeImage](native-image.md)
* `enabled` Boolean - If false, the menu item will be greyed out and unclickable. * `enabled` Boolean - If false, the menu item will be greyed out and
unclickable.
* `visible` Boolean - If false, the menu item will be entirely hidden. * `visible` Boolean - If false, the menu item will be entirely hidden.
* `checked` Boolean - Should only be specified for `checkbox` or `radio` type * `checked` Boolean - Should only be specified for `checkbox` or `radio` type
menu items. menu items.
* `submenu` Menu - Should be specified for `submenu` type menu items. If * `submenu` Menu - Should be specified for `submenu` type menu items. If
`submenu` is specified, the `type: 'submenu'` can be omitted. If the value `submenu` is specified, the `type: 'submenu'` can be omitted. If the value
@ -61,7 +62,8 @@ On OS X `role` can also have following additional values:
* `help` - The submenu is a "Help" menu * `help` - The submenu is a "Help" menu
* `services` - The submenu is a "Services" menu * `services` - The submenu is a "Services" menu
When specifying `role` on OS X, `label` and `accelerator` are the only options that will affect the MenuItem. All other options will be ignored. When specifying `role` on OS X, `label` and `accelerator` are the only options
that will affect the MenuItem. All other options will be ignored.
## Instance Properties ## Instance Properties
@ -79,4 +81,3 @@ selected. You can add a `click` function to do additional work.
A `radio` menu item will turn on its `checked` property when clicked, and A `radio` menu item will turn on its `checked` property when clicked, and
will turn off that property for all adjacent items in the same menu. Again, will turn off that property for all adjacent items in the same menu. Again,
you can add a `click` function for additional behavior. you can add a `click` function for additional behavior.

View file

@ -10,8 +10,8 @@ upstream node:
* `process.resourcesPath` String - Path to JavaScript source code. * `process.resourcesPath` String - Path to JavaScript source code.
* `process.mas` Boolean - For Mac App Store build, this value is `true`, for * `process.mas` Boolean - For Mac App Store build, this value is `true`, for
other builds it is `undefined`. other builds it is `undefined`.
* `process.windowsStore` Boolean - If the app is running as a Windows Store app (appx), this value is `true`, for * `process.windowsStore` Boolean - If the app is running as a Windows Store app
other builds it is `undefined`. (appx), this value is `true`, for other builds it is `undefined`.
## Events ## Events

View file

@ -447,8 +447,9 @@ The `callback` has to be called with an `response` object:
* `cancel` Boolean * `cancel` Boolean
* `responseHeaders` Object (optional) - When provided, the server is assumed * `responseHeaders` Object (optional) - When provided, the server is assumed
to have responded with these headers. to have responded with these headers.
* `statusLine` String (optional) - Should be provided when overriding `responseHeaders` * `statusLine` String (optional) - Should be provided when overriding
to change header status otherwise original response header's status will be used. `responseHeaders` to change header status otherwise original response
header's status will be used.
#### `ses.webRequest.onResponseStarted([filter, ]listener)` #### `ses.webRequest.onResponseStarted([filter, ]listener)`

View file

@ -11,8 +11,8 @@ both processes.
The basic rule is: if a module is [GUI][gui] or low-level system related, then The basic rule is: if a module is [GUI][gui] or low-level system related, then
it should be only available in the main process. You need to be familiar with it should be only available in the main process. You need to be familiar with
the concept of [main process vs. renderer process](../tutorial/quick-start.md#the-main-process) scripts to be the concept of [main process vs. renderer process](../tutorial/quick-start.md#the-main-process)
able to use those modules. scripts to be able to use those modules.
The main process script is just like a normal Node.js script: The main process script is just like a normal Node.js script:

View file

@ -278,7 +278,8 @@ Emitted when media is paused or done playing.
### Event: 'did-change-theme-color' ### Event: 'did-change-theme-color'
Emitted when a page's theme color changes. This is usually due to encountering a meta tag: Emitted when a page's theme color changes. This is usually due to encountering
a meta tag:
```html ```html
<meta name='theme-color' content='#ff0000'> <meta name='theme-color' content='#ff0000'>
@ -355,7 +356,8 @@ Returns whether web page is still loading resources.
### `webContents.isLoadingMainFrame()` ### `webContents.isLoadingMainFrame()`
Returns whether the main frame (and not just iframes or frames within it) is still loading. Returns whether the main frame (and not just iframes or frames within it) is
still loading.
### `webContents.isWaitingForResponse()` ### `webContents.isWaitingForResponse()`
@ -525,9 +527,10 @@ Inserts `text` to the focused element.
uppercase letter followed by a lowercase or non-letter. uppercase letter followed by a lowercase or non-letter.
Accepts several other intra-word matches, defaults to `false`. Accepts several other intra-word matches, defaults to `false`.
Starts a request to find all matches for the `text` in the web page and returns an `Integer` Starts a request to find all matches for the `text` in the web page and returns
representing the request id used for the request. The result of the request can be an `Integer` representing the request id used for the request. The result of
obtained by subscribing to [`found-in-page`](web-contents.md#event-found-in-page) event. the request can be obtained by subscribing to
[`found-in-page`](web-contents.md#event-found-in-page) event.
### `webContents.stopFindInPage(action)` ### `webContents.stopFindInPage(action)`

View file

@ -47,17 +47,17 @@ and displays a "loading..." message during the load time:
## CSS Styling Notes ## CSS Styling Notes
Please note that the `webview` tag's style uses `display:flex;` internally to Please note that the `webview` tag's style uses `display:flex;` internally to
ensure the child `object` element fills the full height and width of its `webview` ensure the child `object` element fills the full height and width of its `webview`
container when used with traditional and flexbox layouts (since v0.36.11). Please container when used with traditional and flexbox layouts (since v0.36.11). Please
do not overwrite the default `display:flex;` CSS property, unless specifying do not overwrite the default `display:flex;` CSS property, unless specifying
`display:inline-flex;` for inline layout. `display:inline-flex;` for inline layout.
`webview` has issues being hidden using the `hidden` attribute or using `display: none;`. `webview` has issues being hidden using the `hidden` attribute or using `display: none;`.
It can cause unusual rendering behaviour within its child `browserplugin` object It can cause unusual rendering behaviour within its child `browserplugin` object
and the web page is reloaded, when the `webview` is un-hidden, as opposed to just and the web page is reloaded, when the `webview` is un-hidden, as opposed to just
becoming visible again. The recommended approach is to hide the `webview` using becoming visible again. The recommended approach is to hide the `webview` using
CSS by zeroing the `width` & `height` and allowing the element to shrink to the 0px CSS by zeroing the `width` & `height` and allowing the element to shrink to the 0px
dimensions via `flex`. dimensions via `flex`.
```html ```html
@ -70,7 +70,7 @@ dimensions via `flex`.
webview.hide { webview.hide {
flex: 0 1; flex: 0 1;
width: 0px; width: 0px;
height: 0px; height: 0px;
} }
</style> </style>
``` ```

View file

@ -22,8 +22,8 @@ $ git clone https://github.com/electron/electron.git
## Bootstrapping ## Bootstrapping
The bootstrap script will download all necessary build dependencies and create The bootstrap script will download all necessary build dependencies and create
the build project files. Notice that we're using [ninja](https://ninja-build.org/) to build Electron so the build project files. Notice that we're using [ninja](https://ninja-build.org/)
there is no Xcode project generated. to build Electron so there is no Xcode project generated.
```bash ```bash
$ cd electron $ cd electron

View file

@ -11,7 +11,8 @@ Follow the guidelines below for building Electron on Windows.
* [Node.js](http://nodejs.org/download/) * [Node.js](http://nodejs.org/download/)
* [Git](http://git-scm.com) * [Git](http://git-scm.com)
If you don't currently have a Windows installation, [modern.ie](https://www.modern.ie/en-us/virtualization-tools#downloads) If you don't currently have a Windows installation,
[modern.ie](https://www.modern.ie/en-us/virtualization-tools#downloads)
has timebombed versions of Windows that you can use to build Electron. has timebombed versions of Windows that you can use to build Electron.
Building Electron is done entirely with command-line scripts and cannot be done Building Electron is done entirely with command-line scripts and cannot be done

View file

@ -1,7 +1,8 @@
# Build System Overview # Build System Overview
Electron uses [gyp](https://gyp.gsrc.io/) for project generation and [ninja](https://ninja-build.org/) for building. Project Electron uses [gyp](https://gyp.gsrc.io/) for project generation and
configurations can be found in the `.gyp` and `.gypi` files. [ninja](https://ninja-build.org/) for building. Project configurations can
be found in the `.gyp` and `.gypi` files.
## Gyp Files ## Gyp Files

View file

@ -45,8 +45,10 @@ Electron APIs uses the same capitalization scheme as Node.js:
- When the module itself is a class like `BrowserWindow`, use `CamelCase`. - When the module itself is a class like `BrowserWindow`, use `CamelCase`.
- When the module is a set of APIs, like `globalShortcut`, use `mixedCase`. - When the module is a set of APIs, like `globalShortcut`, use `mixedCase`.
- When the API is a property of object, and it is complex enough to be in a separate chapter like `win.webContents`, use `mixedCase`. - When the API is a property of object, and it is complex enough to be in a
- For other non-module APIs, use natural titles, like `<webview> Tag` or `Process Object`. separate chapter like `win.webContents`, use `mixedCase`.
- For other non-module APIs, use natural titles, like `<webview> Tag` or
`Process Object`.
When creating a new API, it is preferred to use getters and setters instead of When creating a new API, it is preferred to use getters and setters instead of
jQuery's one-function style. For example, `.getText()` and `.setText(text)` jQuery's one-function style. For example, `.getText()` and `.setText(text)`

View file

@ -77,8 +77,8 @@ app.on('ready', function() {
## I can not use jQuery/RequireJS/Meteor/AngularJS in Electron. ## I can not use jQuery/RequireJS/Meteor/AngularJS in Electron.
Due to the Node.js integration of Electron, there are some extra symbols Due to the Node.js integration of Electron, there are some extra symbols
inserted into the DOM like `module`, `exports`, `require`. This causes problems for inserted into the DOM like `module`, `exports`, `require`. This causes problems
some libraries since they want to insert the symbols with the same names. for some libraries since they want to insert the symbols with the same names.
To solve this, you can turn off node integration in Electron: To solve this, you can turn off node integration in Electron:

View file

@ -68,9 +68,10 @@ $ ELECTRON_RUN_AS_NODE=true path/to/electron.exe node_modules/node-inspector/bin
### 7. Load the debugger UI ### 7. Load the debugger UI
Open http://127.0.0.1:8080/debug?ws=127.0.0.1:8080&port=5858 in the Chrome browser. You may have to click pause if starting with debug-brk to see the entry line. Open http://127.0.0.1:8080/debug?ws=127.0.0.1:8080&port=5858 in the Chrome
browser. You may have to click pause if starting with debug-brk to see the
entry line.
[node-inspector]: https://github.com/node-inspector/node-inspector [node-inspector]: https://github.com/node-inspector/node-inspector
[node-gyp-required-tools]: https://github.com/nodejs/node-gyp#installation [node-gyp-required-tools]: https://github.com/nodejs/node-gyp#installation
[how-to-install-native-modules]: using-native-node-modules.md#how-to-install-native-modules [how-to-install-native-modules]: using-native-node-modules.md#how-to-install-native-modules

View file

@ -53,8 +53,7 @@ GNOME, KDE.
### OS X ### OS X
Notifications are straight-forward on OS X, you should however be aware of Notifications are straight-forward on OS X, you should however be aware of
[Apple's Human Interface guidelines regarding [Apple's Human Interface guidelines regarding notifications](https://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/OSXHIGuidelines/NotificationCenter.html).
notifications](https://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/OSXHIGuidelines/NotificationCenter.html).
Note that notifications are limited to 256 bytes in size - and will be truncated Note that notifications are limited to 256 bytes in size - and will be truncated
if you exceed that limit. if you exceed that limit.

View file

@ -147,8 +147,8 @@ working as expected.
### electron-prebuilt ### electron-prebuilt
If you've installed `electron-prebuilt` globally with `npm`, then you will only need If you've installed `electron-prebuilt` globally with `npm`, then you will only
to run the following in your app's source directory: need to run the following in your app's source directory:
```bash ```bash
electron . electron .