Merge pull request #2314 from UsabilityEtc/update-api-docs

Update api docs
This commit is contained in:
Cheng Zhao 2015-07-29 11:35:14 +08:00
commit 1bc49487ad
5 changed files with 58 additions and 59 deletions

View file

@ -1,6 +1,6 @@
# Accelerator # Accelerator
An accelerator is string that represents a keyboard shortcut, it can contain An accelerator is a string that represents a keyboard shortcut. It can contain
multiple modifiers and key codes, combined by the `+` character. multiple modifiers and key codes, combined by the `+` character.
Examples: Examples:
@ -10,7 +10,7 @@ Examples:
## Platform notice ## Platform notice
On Linux and Windows, the `Command` key would not have any effect, you can On Linux and Windows, the `Command` key does not have any effect so
use `CommandOrControl` which represents `Command` on OS X and `Control` on use `CommandOrControl` which represents `Command` on OS X and `Control` on
Linux and Windows to define some accelerators. Linux and Windows to define some accelerators.

View file

@ -3,9 +3,9 @@
**This module has only been implemented for OS X.** **This module has only been implemented for OS X.**
Check out [atom/grunt-electron-installer](https://github.com/atom/grunt-electron-installer) Check out [atom/grunt-electron-installer](https://github.com/atom/grunt-electron-installer)
for building a Windows installer for your app. to build a Windows installer for your app.
The `auto-updater` module is a simple wrap around the The `auto-updater` module is a simple wrapper around the
[Squirrel.Mac](https://github.com/Squirrel/Squirrel.Mac) framework. [Squirrel.Mac](https://github.com/Squirrel/Squirrel.Mac) framework.
Squirrel.Mac requires that your `.app` folder is signed using the Squirrel.Mac requires that your `.app` folder is signed using the
@ -26,11 +26,11 @@ body so that your server has the context it needs in order to supply the most
suitable update. suitable update.
The update JSON Squirrel requests should be dynamically generated based on The update JSON Squirrel requests should be dynamically generated based on
criteria in the request, and whether an update is required. Squirrel relies criteria in the request and whether an update is required. Squirrel relies
on server side support for determining whether an update is required, see on server-side support to determine whether an update is required. See
[Server Support](#server-support). [Server Support](#server-support).
Squirrel's installer is also designed to be fault tolerant, and ensure that any Squirrel's installer is designed to be fault tolerant and ensures that any
updates installed are valid. updates installed are valid.
## Update Requests ## Update Requests
@ -40,11 +40,11 @@ update checking. `Accept: application/json` is added to the request headers
because Squirrel is responsible for parsing the response. because Squirrel is responsible for parsing the response.
For the requirements imposed on the responses and the body format of an update For the requirements imposed on the responses and the body format of an update
response see [Server Support](#server-support). response, see [Server Support](#server-support).
Your update request must *at least* include a version identifier so that the Your update request must *at least* include a version identifier so that the
server can determine whether an update for this specific version is required. It server can determine whether an update for this specific version is required. It
may also include other identifying criteria such as operating system version or may also include other identifying criteria, such as operating system version or
username, to allow the server to deliver as fine grained an update as you username, to allow the server to deliver as fine grained an update as you
would like. would like.
@ -64,7 +64,7 @@ autoUpdater.setFeedUrl('http://mycompany.com/myapp/latest?version=' + app.getVer
Your server should determine whether an update is required based on the Your server should determine whether an update is required based on the
[Update Request](#update-requests) your client issues. [Update Request](#update-requests) your client issues.
If an update is required your server should respond with a status code of If an update is required, your server should respond with a status code of
[200 OK](http://tools.ietf.org/html/rfc2616#section-10.2.1) and include the [200 OK](http://tools.ietf.org/html/rfc2616#section-10.2.1) and include the
[update JSON](#update-json-format) in the body. Squirrel **will** download and [update JSON](#update-json-format) in the body. Squirrel **will** download and
install this update, even if the version of the update is the same as the install this update, even if the version of the update is the same as the
@ -89,29 +89,29 @@ to the update request provided:
} }
``` ```
The only required key is "url", the others are optional. The only required key is "url"; the others are optional.
Squirrel will request "url" with `Accept: application/zip` and only supports Squirrel will request "url" with `Accept: application/zip` and only supports
installing ZIP updates. If future update formats are supported their MIME type installing ZIP updates. If future update formats are supported their MIME type
will be added to the `Accept` header so that your server can return the will be added to the `Accept` header so that your server can return the
appropriate format. appropriate format.
`pub_date` if present must be formatted according to ISO 8601. `pub_date` (if present) must be formatted according to ISO 8601.
## Event: error ## Event: error
* `event` Event * `event` Event
* `message` String * `message` String
Emitted when there is an error updating. Emitted when there is an error while updating.
## Event: checking-for-update ## Event: checking-for-update
Emitted when checking for update has started. Emitted when checking if an update has started.
## Event: update-available ## Event: update-available
Emitted when there is an available update, the update would be downloaded Emitted when there is an available update. The update is downloaded
automatically. automatically.
## Event: update-not-available ## Event: update-not-available
@ -127,17 +127,17 @@ Emitted when there is no available update.
* `updateUrl` String * `updateUrl` String
* `quitAndUpdate` Function * `quitAndUpdate` Function
Emitted when update has been downloaded, calling `quitAndUpdate()` would restart Emitted when an update has been downloaded. Calling `quitAndUpdate()` will restart
the application and install the update. the application and install the update.
## autoUpdater.setFeedUrl(url) ## autoUpdater.setFeedUrl(url)
* `url` String * `url` String
Set the `url` and initialize the auto updater. The `url` could not be changed Set the `url` and initialize the auto updater. The `url` cannot be changed
once it is set. once it is set.
## autoUpdater.checkForUpdates() ## autoUpdater.checkForUpdates()
Ask the server whether there is an update, you have to call `setFeedUrl` before Ask the server whether there is an update. You must call `setFeedUrl` before
using this API. using this API.

View file

@ -1,7 +1,7 @@
# Supported Chrome command line switches # Supported Chrome command line switches
The following command lines switches in Chrome browser are also supported in This page lists the command line switches used by the Chrome browser that are also supported by
Electron, you can use [app.commandLine.appendSwitch][append-switch] to append 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] them in your app's main script before the [ready][ready] event of [app][app]
module is emitted: module is emitted:
@ -17,11 +17,11 @@ app.on('ready', function() {
## --client-certificate=`path` ## --client-certificate=`path`
Sets `path` of client certificate file. Sets the `path` of client certificate file.
## --ignore-connections-limit=`domains` ## --ignore-connections-limit=`domains`
Ignore the connections limit for `domains` list seperated by `,`. Ignore the connections limit for `domains` list separated by `,`.
## --disable-http-cache ## --disable-http-cache
@ -29,11 +29,11 @@ Disables the disk cache for HTTP requests.
## --remote-debugging-port=`port` ## --remote-debugging-port=`port`
Enables remote debug over HTTP on the specified `port`. Enables remote debugging over HTTP on the specified `port`.
## --proxy-server=`address:port` ## --proxy-server=`address:port`
Uses a specified proxy server, overrides system settings. This switch only Use a specified proxy server, which overrides the system setting. This switch only
affects HTTP and HTTPS requests. affects HTTP and HTTPS requests.
## --proxy-pac-url=`url` ## --proxy-pac-url=`url`
@ -42,12 +42,12 @@ Uses the PAC script at the specified `url`.
## --no-proxy-server ## --no-proxy-server
Don't use a proxy server, always make direct connections. Overrides any other Don't use a proxy server and always make direct connections. Overrides any other
proxy server flags that are passed. proxy server flags that are passed.
## --host-rules=`rules` ## --host-rules=`rules`
Comma-separated list of `rules` that control how hostnames are mapped. A comma-separated list of `rules` that control how hostnames are mapped.
For example: For example:
@ -60,7 +60,7 @@ For example:
"www.google.com". "www.google.com".
These mappings apply to the endpoint host in a net request (the TCP connect These mappings apply to the endpoint host in a net request (the TCP connect
and host resolver in a direct connection, and the `CONNECT` in an http proxy and host resolver in a direct connection, and the `CONNECT` in an HTTP proxy
connection, and the endpoint host in a `SOCKS` proxy connection). connection, and the endpoint host in a `SOCKS` proxy connection).
## --host-resolver-rules=`rules` ## --host-resolver-rules=`rules`
@ -77,15 +77,15 @@ Ignores certificate related errors.
## --ppapi-flash-path=`path` ## --ppapi-flash-path=`path`
Sets `path` of pepper flash plugin. Sets the `path` of the pepper flash plugin.
## --ppapi-flash-version=`version` ## --ppapi-flash-version=`version`
Sets `version` of pepper flash plugin. Sets the `version` of the pepper flash plugin.
## --log-net-log=`path` ## --log-net-log=`path`
Enables saving net log events and writes them to `path`. Enables net log events to be saved and writes them to `path`.
## --v=`log_level` ## --v=`log_level`
@ -102,7 +102,7 @@ source files `my_module.*` and `foo*.*`.
Any pattern containing a forward or backward slash will be tested against the Any pattern containing a forward or backward slash will be tested against the
whole pathname and not just the module. E.g. `*/foo/bar/*=2` would change the whole pathname and not just the module. E.g. `*/foo/bar/*=2` would change the
logging level for all code in source files under a `foo/bar` directory. logging level for all code in the source files under a `foo/bar` directory.
To disable all chromium related logs and only enable your application logs you To disable all chromium related logs and only enable your application logs you
can do: can do:

View file

@ -1,14 +1,14 @@
# clipboard # clipboard
The `clipboard` provides methods to do copy/paste operations. An example of The `clipboard` provides methods to perform copy and paste operations. The following example
writing a string to clipboard: shows how to write a string to the clipboard:
```javascript ```javascript
var clipboard = require('clipboard'); var clipboard = require('clipboard');
clipboard.writeText('Example String'); clipboard.writeText('Example String');
``` ```
On X Window systems, there is also a selection clipboard, to manipulate in it On X Window systems, there is also a selection clipboard. To manipulate it
you need to pass `selection` to each method: you need to pass `selection` to each method:
```javascript ```javascript
@ -21,46 +21,46 @@ console.log(clipboard.readText('selection'));
* `type` String * `type` String
Returns the content in clipboard as plain text. Returns the content in the clipboard as plain text.
## clipboard.writeText(text[, type]) ## clipboard.writeText(text[, type])
* `text` String * `text` String
* `type` String * `type` String
Writes the `text` into clipboard as plain text. Writes the `text` into the clipboard as plain text.
## clipboard.readHtml([type]) ## clipboard.readHtml([type])
* `type` String * `type` String
Returns the content in clipboard as markup. Returns the content in the clipboard as markup.
## clipboard.writeHtml(markup[, type]) ## clipboard.writeHtml(markup[, type])
* `markup` String * `markup` String
* `type` String * `type` String
Writes the `markup` into clipboard. Writes `markup` into the clipboard.
## clipboard.readImage([type]) ## clipboard.readImage([type])
* `type` String * `type` String
Returns the content in clipboard as [NativeImage](native-image.md). Returns the content in the clipboard as a [NativeImage](native-image.md).
## clipboard.writeImage(image[, type]) ## clipboard.writeImage(image[, type])
* `image` [NativeImage](native-image.md) * `image` [NativeImage](native-image.md)
* `type` String * `type` String
Writes the `image` into clipboard. Writes `image` into the clipboard.
## clipboard.clear([type]) ## clipboard.clear([type])
* `type` String * `type` String
Clears everything in clipboard. Clears the clipboard.
## clipboard.availableFormats([type]) ## clipboard.availableFormats([type])
@ -71,7 +71,7 @@ Returns an array of supported `format` for the clipboard `type`.
* `data` String * `data` String
* `type` String * `type` String
Returns whether clipboard supports the format of specified `data`. Returns whether the clipboard supports the format of specified `data`.
```javascript ```javascript
var clipboard = require('clipboard'); var clipboard = require('clipboard');
@ -85,7 +85,7 @@ console.log(clipboard.has('<p>selection</p>'));
* `data` String * `data` String
* `type` String * `type` String
Reads the `data` in clipboard. Reads `data` from the clipboard.
**Note:** This API is experimental and could be removed in future. **Note:** This API is experimental and could be removed in future.
@ -101,4 +101,4 @@ Reads the `data` in clipboard.
var clipboard = require('clipboard'); var clipboard = require('clipboard');
clipboard.write({text: 'test', html: "<b>test</b>"}); clipboard.write({text: 'test', html: "<b>test</b>"});
``` ```
Writes the `data` iinto clipboard. Writes `data` into clipboard.

View file

@ -1,6 +1,6 @@
# crash-reporter # crash-reporter
An example of automatically submitting crash reporters to a remote server: The following is an example of automatically submitting a crash report to a remote server:
```javascript ```javascript
crashReporter = require('crash-reporter'); crashReporter = require('crash-reporter');
@ -18,31 +18,30 @@ crashReporter.start({
* `productName` String, default: Electron * `productName` String, default: Electron
* `companyName` String, default: GitHub, Inc * `companyName` String, default: GitHub, Inc
* `submitUrl` String, default: http://54.249.141.255:1127/post * `submitUrl` String, default: http://54.249.141.255:1127/post
* URL that crash reports would be sent to as POST * URL that crash reports will be sent to as POST
* `autoSubmit` Boolean, default: true * `autoSubmit` Boolean, default: true
* Send the crash report without user interaction * Send the crash report without user interaction
* `ignoreSystemCrashHandler` Boolean, default: false * `ignoreSystemCrashHandler` Boolean, default: false
* `extra` Object * `extra` Object
* An object you can define which content will be send along with the report. * An object you can define that will be sent along with the report.
* Only string properties are sent correctly. * Only string properties are sent correctly.
* Nested objects are not supported. * Nested objects are not supported.
Developers are required to call this method before using other crashReporter APIs. Developers are required to call this method before using other `crashReporter` APIs.
**Note:** On OS X, Electron uses a new `crashpad` client, which is different
**Note:** On OS X, electron uses a new `crashpad` client, which is different from `breakpad` on Windows and Linux. To enable the crash collection feature,
with the `breakpad` on Windows and Linux. To enable crash collection feature, you are required to call `crashReporter.start` API to initialize `crashpad` in the
you are required to call `crashReporter.start` API to initialize `crashpad` in main process and in each renderer process from which you wish to collect crash reports.
main process and in each renderer process that you wish to collect crash reports.
## crashReporter.getLastCrashReport() ## crashReporter.getLastCrashReport()
Returns the date and ID of the last crash report, when there was no crash report Returns the date and ID of the last crash report. If no crash reports have been
sent or the crash reporter is not started, `null` will be returned. sent or the crash reporter has not been started, `null` is returned.
## crashReporter.getUploadedReports() ## crashReporter.getUploadedReports()
Returns all uploaded crash reports, each report contains date and uploaded ID. Returns all uploaded crash reports. Each report contains the date and uploaded ID.
# crash-reporter payload # crash-reporter payload
@ -54,8 +53,8 @@ The crash reporter will send the following data to the `submitUrl` as `POST`:
* `process_type` String - e.g. 'renderer' * `process_type` String - e.g. 'renderer'
* `ptime` Number * `ptime` Number
* `_version` String - The version in `package.json` * `_version` String - The version in `package.json`
* `_productName` String - The product name in the crashReporter `options` object * `_productName` String - The product name in the `crashReporter` `options` object
* `prod` String - Name of the underlying product. In this case Electron * `prod` String - Name of the underlying product. In this case Electron
* `_companyName` String - The company name in the crashReporter `options` object * `_companyName` String - The company name in the `crashReporter` `options` object
* `upload_file_minidump` File - The crashreport as file * `upload_file_minidump` File - The crashreport as file
* All level one properties of the `extra` object in the crashReporter `options` object * All level one properties of the `extra` object in the `crashReporter` `options` object