Merge branch 'master' into nativeimage_ico_support_windows
This commit is contained in:
commit
2bc087b5d5
163 changed files with 3511 additions and 909 deletions
|
@ -1,6 +1,6 @@
|
|||
# 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.
|
||||
|
||||
Examples:
|
||||
|
@ -10,7 +10,7 @@ Examples:
|
|||
|
||||
## 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
|
||||
Linux and Windows to define some accelerators.
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ In most cases, you should just do everything in the `ready` event handler.
|
|||
|
||||
## Event: ready
|
||||
|
||||
Emitted when Electron has finsished initialization.
|
||||
Emitted when Electron has finished initialization.
|
||||
|
||||
## Event: window-all-closed
|
||||
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
**This module has only been implemented for OS X.**
|
||||
|
||||
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 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.
|
||||
|
||||
The update JSON Squirrel requests should be dynamically generated based on
|
||||
criteria in the request, and whether an update is required. Squirrel relies
|
||||
on server side support for determining whether an update is required, see
|
||||
criteria in the request and whether an update is required. Squirrel relies
|
||||
on server-side support to determine whether an update is required. See
|
||||
[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.
|
||||
|
||||
## 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.
|
||||
|
||||
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
|
||||
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
|
||||
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
|
||||
[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
|
||||
[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
|
||||
|
@ -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
|
||||
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
|
||||
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` Event
|
||||
* `message` String
|
||||
|
||||
Emitted when there is an error updating.
|
||||
Emitted when there is an error while updating.
|
||||
|
||||
## Event: checking-for-update
|
||||
|
||||
Emitted when checking for update has started.
|
||||
Emitted when checking if an update has started.
|
||||
|
||||
## 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.
|
||||
|
||||
## Event: update-not-available
|
||||
|
@ -127,17 +127,17 @@ Emitted when there is no available update.
|
|||
* `updateUrl` String
|
||||
* `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.
|
||||
|
||||
## autoUpdater.setFeedUrl(url)
|
||||
|
||||
* `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.
|
||||
|
||||
## 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.
|
||||
|
|
|
@ -76,7 +76,14 @@ You can also create a window without chrome by using
|
|||
textured window. Defaults to `true`.
|
||||
* `web-preferences` Object - Settings of web page's features
|
||||
* `javascript` Boolean
|
||||
* `web-security` Boolean
|
||||
* `web-security` Boolean - When setting `false`, it will disable the same-origin
|
||||
policy(Usually using testing websites by people), and set `allow_displaying_insecure_content`
|
||||
and `allow_running_insecure_content` to `true` if these two options are not
|
||||
set by user.
|
||||
* `allow-displaying-insecure-content` Boolean - Allow a https page to display
|
||||
content like image from http URLs.
|
||||
* `allow-running-insecure-content` Boolean - Allow a https page to run JavaScript,
|
||||
CSS or plugins from http URLs.
|
||||
* `images` Boolean
|
||||
* `java` Boolean
|
||||
* `text-areas-are-resizable` Boolean
|
||||
|
@ -361,6 +368,19 @@ Sets whether the window should be in fullscreen mode.
|
|||
|
||||
Returns whether the window is in fullscreen mode.
|
||||
|
||||
### BrowserWindow.setAspectRatio(aspectRatio[, extraSize])
|
||||
|
||||
* `aspectRatio` The aspect ratio we want to maintain for some portion of the content view.
|
||||
* `rect` Object - The extra size to not be included in the aspect ratio to be maintained.
|
||||
* `width` Integer
|
||||
* `height` Integer
|
||||
|
||||
This will have a window maintain an aspect ratio. The extra size allows a developer to be able to have space, specifified in pixels, not included within the aspect ratio calculations. This API already takes into account the difference between a window's size and it's content size.
|
||||
|
||||
Consider a normal window with an HD video player and associated controls. Perhaps there are 15 pixels of controls on the left edge, 25 pixels of controls on the right edge and 50 pixels of controls below the player. In order to maintain a 16:9 aspect ratio (standard aspect ratio for HD @1920x1080) within the player itself we would call this function with arguments of 16/9 and [ 40, 50 ]. The second argument doesn't care where the extra width and height are within the content view — only that they exist. Just sum any extra width and height areas you have within the overall content view.
|
||||
|
||||
__Note__: This API is only implemented on OS X.
|
||||
|
||||
### BrowserWindow.setBounds(options)
|
||||
|
||||
* `options` Object
|
||||
|
@ -623,6 +643,39 @@ Sets a 16px overlay onto the current taskbar icon, usually used to convey some s
|
|||
|
||||
__Note:__ This API is only available on Windows (Windows 7 and above)
|
||||
|
||||
|
||||
### BrowserWindow.setThumbarButtons(buttons)
|
||||
|
||||
* `buttons` Array
|
||||
* `button` Object
|
||||
* `icon` [NativeImage](native-image.md) - The icon showing in thumbnail
|
||||
toolbar.
|
||||
* `tooltip` String (optional) - The text of the button's tooltip.
|
||||
* `flags` Array (optional) - Control specific states and behaviors
|
||||
of the button. By default, it uses `enabled`. It can include following
|
||||
Strings:
|
||||
* `enabled` - The button is active and available to the user.
|
||||
* `disabled` - The button is disabled. It is present, but has a visual
|
||||
state that indicates that it will not respond to user action.
|
||||
* `dismissonclick` - When the button is clicked, the taskbar button's
|
||||
flyout closes immediately.
|
||||
* `nobackground` - Do not draw a button border, use only the image.
|
||||
* `hidden` - The button is not shown to the user.
|
||||
* `noninteractive` - The button is enabled but not interactive; no
|
||||
pressed button state is drawn. This value is intended for instances
|
||||
where the button is used in a notification.
|
||||
* `click` - Function
|
||||
|
||||
Add a thumbnail toolbar with a specified set of buttons to the thumbnail image
|
||||
of a window in a taskbar button layout. Returns a `Boolean` object indicates
|
||||
whether the thumbnail has been added successfully.
|
||||
|
||||
__Note:__ This API is only available on Windows (Windows 7 and above).
|
||||
The number of buttons in thumbnail toolbar should be no greater than 7 due to
|
||||
the limited room. Once you setup the thumbnail toolbar, the toolbar cannot be
|
||||
removed due to the platform's limitation. But you can call the API with an empty
|
||||
array to clean the buttons.
|
||||
|
||||
### BrowserWindow.showDefinitionForSelection()
|
||||
|
||||
Shows pop-up dictionary that searches the selected word on the page.
|
||||
|
@ -885,12 +938,17 @@ Returns a `String` represents the user agent for this page.
|
|||
|
||||
Injects CSS into this page.
|
||||
|
||||
### WebContents.executeJavaScript(code)
|
||||
### WebContents.executeJavaScript(code[, userGesture])
|
||||
|
||||
* `code` String
|
||||
* `userGesture` Boolean
|
||||
|
||||
Evaluates `code` in page.
|
||||
|
||||
In browser some HTML APIs like `requestFullScreen` can only be invoked if it
|
||||
is started by user gesture, by specifying `userGesture` to `true` developers
|
||||
can ignore this limitation.
|
||||
|
||||
### WebContents.setAudioMuted(muted)
|
||||
|
||||
+ `muted` Boolean
|
||||
|
@ -988,6 +1046,12 @@ size.
|
|||
* 0 - default
|
||||
* 1 - none
|
||||
* 2 - minimum
|
||||
* `pageSize` String - Specify page size of the generated PDF
|
||||
* `A4`
|
||||
* `A3`
|
||||
* `Legal`
|
||||
* `Letter`
|
||||
* `Tabloid`
|
||||
* `printBackground` Boolean - Whether to print CSS backgrounds.
|
||||
* `printSelectionOnly` Boolean - Whether to print selection only.
|
||||
* `landscape` Boolean - `true` for landscape, `false` for portrait.
|
||||
|
@ -1014,14 +1078,27 @@ win.webContents.on("did-finish-load", function() {
|
|||
// Use default printing options
|
||||
win.webContents.printToPDF({}, function(error, data) {
|
||||
if (error) throw error;
|
||||
fs.writeFile(dist, data, function(error) {
|
||||
fs.writeFile("/tmp/print.pdf", data, function(error) {
|
||||
if (err)
|
||||
alert('write pdf file error', error);
|
||||
throw error;
|
||||
console.log("Write PDF successfully.");
|
||||
})
|
||||
})
|
||||
});
|
||||
```
|
||||
|
||||
### WebContents.addWorkSpace(path)
|
||||
|
||||
* `path` String
|
||||
|
||||
Adds the specified path to devtools workspace.
|
||||
|
||||
### WebContents.removeWorkSpace(path)
|
||||
|
||||
* `path` String
|
||||
|
||||
Removes the specified path from devtools workspace.
|
||||
|
||||
### WebContents.send(channel[, args...])
|
||||
|
||||
* `channel` String
|
||||
|
@ -1207,3 +1284,10 @@ proxy-uri = [<proxy-scheme>"://"]<proxy-host>[":"<proxy-port>]
|
|||
and use socks4://foopy2 for all other
|
||||
URLs.
|
||||
```
|
||||
|
||||
### Session.setDownloadPath(path)
|
||||
|
||||
* `path` String - The download location
|
||||
|
||||
Sets download saving directory. By default, the download directory will be the
|
||||
`Downloads` under the respective app folder.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Supported Chrome command line switches
|
||||
|
||||
The following command lines switches in Chrome browser are also supported in
|
||||
Electron, you can use [app.commandLine.appendSwitch][append-switch] to append
|
||||
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
|
||||
them in your app's main script before the [ready][ready] event of [app][app]
|
||||
module is emitted:
|
||||
|
||||
|
@ -17,11 +17,11 @@ app.on('ready', function() {
|
|||
|
||||
## --client-certificate=`path`
|
||||
|
||||
Sets `path` of client certificate file.
|
||||
Sets the `path` of client certificate file.
|
||||
|
||||
## --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
|
||||
|
||||
|
@ -29,11 +29,11 @@ Disables the disk cache for HTTP requests.
|
|||
|
||||
## --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`
|
||||
|
||||
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.
|
||||
|
||||
## --proxy-pac-url=`url`
|
||||
|
@ -42,12 +42,12 @@ Uses the PAC script at the specified `url`.
|
|||
|
||||
## --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.
|
||||
|
||||
## --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:
|
||||
|
||||
|
@ -60,7 +60,7 @@ For example:
|
|||
"www.google.com".
|
||||
|
||||
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).
|
||||
|
||||
## --host-resolver-rules=`rules`
|
||||
|
@ -77,15 +77,15 @@ Ignores certificate related errors.
|
|||
|
||||
## --ppapi-flash-path=`path`
|
||||
|
||||
Sets `path` of pepper flash plugin.
|
||||
Sets the `path` of the pepper flash plugin.
|
||||
|
||||
## --ppapi-flash-version=`version`
|
||||
|
||||
Sets `version` of pepper flash plugin.
|
||||
Sets the `version` of the pepper flash plugin.
|
||||
|
||||
## --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`
|
||||
|
||||
|
@ -102,7 +102,7 @@ source files `my_module.*` and `foo*.*`.
|
|||
|
||||
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
|
||||
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
|
||||
can do:
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
# clipboard
|
||||
|
||||
The `clipboard` provides methods to do copy/paste operations. An example of
|
||||
writing a string to clipboard:
|
||||
The `clipboard` provides methods to perform copy and paste operations. The following example
|
||||
shows how to write a string to the clipboard:
|
||||
|
||||
```javascript
|
||||
var clipboard = require('clipboard');
|
||||
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:
|
||||
|
||||
```javascript
|
||||
|
@ -21,46 +21,46 @@ console.log(clipboard.readText('selection'));
|
|||
|
||||
* `type` String
|
||||
|
||||
Returns the content in clipboard as plain text.
|
||||
Returns the content in the clipboard as plain text.
|
||||
|
||||
## clipboard.writeText(text[, type])
|
||||
|
||||
* `text` String
|
||||
* `type` String
|
||||
|
||||
Writes the `text` into clipboard as plain text.
|
||||
Writes the `text` into the clipboard as plain text.
|
||||
|
||||
## clipboard.readHtml([type])
|
||||
|
||||
* `type` String
|
||||
|
||||
Returns the content in clipboard as markup.
|
||||
Returns the content in the clipboard as markup.
|
||||
|
||||
## clipboard.writeHtml(markup[, type])
|
||||
|
||||
* `markup` String
|
||||
* `type` String
|
||||
|
||||
Writes the `markup` into clipboard.
|
||||
Writes `markup` into the clipboard.
|
||||
|
||||
## clipboard.readImage([type])
|
||||
|
||||
* `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])
|
||||
|
||||
* `image` [NativeImage](native-image.md)
|
||||
* `type` String
|
||||
|
||||
Writes the `image` into clipboard.
|
||||
Writes `image` into the clipboard.
|
||||
|
||||
## clipboard.clear([type])
|
||||
|
||||
* `type` String
|
||||
|
||||
Clears everything in clipboard.
|
||||
Clears the clipboard.
|
||||
|
||||
## clipboard.availableFormats([type])
|
||||
|
||||
|
@ -71,7 +71,7 @@ Returns an array of supported `format` for the clipboard `type`.
|
|||
* `data` String
|
||||
* `type` String
|
||||
|
||||
Returns whether clipboard supports the format of specified `data`.
|
||||
Returns whether the clipboard supports the format of specified `data`.
|
||||
|
||||
```javascript
|
||||
var clipboard = require('clipboard');
|
||||
|
@ -85,7 +85,7 @@ console.log(clipboard.has('<p>selection</p>'));
|
|||
* `data` String
|
||||
* `type` String
|
||||
|
||||
Reads the `data` in clipboard.
|
||||
Reads `data` from the clipboard.
|
||||
|
||||
**Note:** This API is experimental and could be removed in future.
|
||||
|
||||
|
@ -101,4 +101,4 @@ Reads the `data` in clipboard.
|
|||
var clipboard = require('clipboard');
|
||||
clipboard.write({text: 'test', html: "<b>test</b>"});
|
||||
```
|
||||
Writes the `data` iinto clipboard.
|
||||
Writes `data` into clipboard.
|
||||
|
|
|
@ -28,10 +28,10 @@ are reached.
|
|||
Once all child processes have acked to the `getCategories` request, `callback`
|
||||
is invoked with an array of category groups.
|
||||
|
||||
## tracing.startRecording(categoryFilter, options, callback)
|
||||
## tracing.startRecording(categoryFilter, traceOptions, callback)
|
||||
|
||||
* `categoryFilter` String
|
||||
* `options` Integer
|
||||
* `traceOptions` String
|
||||
* `callback` Function
|
||||
|
||||
Start recording on all processes.
|
||||
|
@ -51,9 +51,23 @@ Examples:
|
|||
* `test_MyTest*,test_OtherStuff`,
|
||||
* `"-excluded_category1,-excluded_category2`
|
||||
|
||||
`options` controls what kind of tracing is enabled, it could be a OR-ed
|
||||
combination of `tracing.DEFAULT_OPTIONS`, `tracing.ENABLE_SYSTRACE`,
|
||||
`tracing.ENABLE_SAMPLING` and `tracing.RECORD_CONTINUOUSLY`.
|
||||
`traceOptions` controls what kind of tracing is enabled, it is a comma-delimited list.
|
||||
Possible options are:
|
||||
|
||||
* `record-until-full`
|
||||
* `record-continuously`
|
||||
* `trace-to-console`
|
||||
* `enable-sampling`
|
||||
* `enable-systrace`
|
||||
|
||||
The first 3 options are trace recoding modes and hence mutually exclusive.
|
||||
If more than one trace recording modes appear in the `traceOptions` string,
|
||||
the last one takes precedence. If none of the trace recording mode is specified,
|
||||
recording mode is `record-until-full`.
|
||||
|
||||
The trace option will first be reset to the default option (record_mode set to
|
||||
`record-until-full`, enable_sampling and enable_systrace set to false)
|
||||
before options parsed from `traceOptions` are applied on it.
|
||||
|
||||
## tracing.stopRecording(resultFilePath, callback)
|
||||
|
||||
|
@ -75,10 +89,10 @@ Trace data will be written into `resultFilePath` if it is not empty, or into a
|
|||
temporary file. The actual file path will be passed to `callback` if it's not
|
||||
null.
|
||||
|
||||
## tracing.startMonitoring(categoryFilter, options, callback)
|
||||
## tracing.startMonitoring(categoryFilter, traceOptions, callback)
|
||||
|
||||
* `categoryFilter` String
|
||||
* `options` Integer
|
||||
* `traceOptions` String
|
||||
* `callback` Function
|
||||
|
||||
Start monitoring on all processes.
|
||||
|
@ -107,7 +121,7 @@ Get the current monitoring traced data.
|
|||
|
||||
Child processes typically are caching trace data and only rarely flush and send
|
||||
trace data back to the main process. That is because it may be an expensive
|
||||
operation to send the trace data over IPC, and we would like to avoid unneeded
|
||||
operation to send the trace data over IPC, and we would like to avoid unneeded
|
||||
runtime overhead of tracing. So, to end tracing, we must asynchronously ask all
|
||||
child processes to flush any pending trace data.
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# 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
|
||||
crashReporter = require('crash-reporter');
|
||||
|
@ -18,31 +18,30 @@ crashReporter.start({
|
|||
* `productName` String, default: Electron
|
||||
* `companyName` String, default: GitHub, Inc
|
||||
* `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
|
||||
* Send the crash report without user interaction
|
||||
* `ignoreSystemCrashHandler` Boolean, default: false
|
||||
* `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.
|
||||
* 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
|
||||
with the `breakpad` on Windows and Linux. To enable crash collection feature,
|
||||
you are required to call `crashReporter.start` API to initialize `crashpad` in
|
||||
main process and in each renderer process that you wish to collect crash reports.
|
||||
**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,
|
||||
you are required to call `crashReporter.start` API to initialize `crashpad` in the
|
||||
main process and in each renderer process from which you wish to collect crash reports.
|
||||
|
||||
## crashReporter.getLastCrashReport()
|
||||
|
||||
Returns the date and ID of the last crash report, when there was no crash report
|
||||
sent or the crash reporter is not started, `null` will be returned.
|
||||
Returns the date and ID of the last crash report. If no crash reports have been
|
||||
sent or the crash reporter has not been started, `null` is returned.
|
||||
|
||||
## 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
|
||||
|
||||
|
@ -54,8 +53,8 @@ The crash reporter will send the following data to the `submitUrl` as `POST`:
|
|||
* `process_type` String - e.g. 'renderer'
|
||||
* `ptime` Number
|
||||
* `_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
|
||||
* `_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
|
||||
* 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
|
||||
|
|
|
@ -70,7 +70,7 @@ will be passed via `callback(filename)`
|
|||
|
||||
* `browserWindow` BrowserWindow
|
||||
* `options` Object
|
||||
* `type` String - Can be `"none"`, `"info"`, `"error"`, `"question"` or `"warning"`
|
||||
* `type` String - Can be `"none"`, `"info"`, `"error"`, `"question"` or `"warning"`. On Windows, "question" displays the same icon as "info", unless if you set an icon using the "icon" option
|
||||
* `buttons` Array - Array of texts for buttons
|
||||
* `title` String - Title of the message box, some platforms will not show it
|
||||
* `message` String - Content of the message box
|
||||
|
@ -80,7 +80,12 @@ will be passed via `callback(filename)`
|
|||
instead of clicking the buttons of the dialog. By default it is the index
|
||||
of the buttons that have "cancel" or "no" as label, or 0 if there is no such
|
||||
buttons. On OS X and Windows the index of "Cancel" button will always be
|
||||
used as `cancelId`, not matter whether it is already specified.
|
||||
used as `cancelId`, not matter whether it is already specified
|
||||
* `noLink` Boolean - On Windows Electron would try to figure out which ones of
|
||||
the `buttons` are common buttons (like "Cancel" or "Yes"), and show the
|
||||
others as command links in the dialog, this can make the dialog appear in
|
||||
the style of modern Windows apps. If you don't like this behavior, you can
|
||||
specify `noLink` to `true`
|
||||
* `callback` Function
|
||||
|
||||
Shows a message box, it will block until the message box is closed. It returns
|
||||
|
|
|
@ -29,6 +29,8 @@ window.addEventListener('contextmenu', function (e) {
|
|||
|
||||
Another example of creating the application menu with the simple template API:
|
||||
|
||||
**Note to Window and Linux users** the `selector` member of each menu item is a Mac-only [Accelerator option](https://github.com/atom/electron/blob/master/docs/api/accelerator.md).
|
||||
|
||||
```html
|
||||
<!-- index.html -->
|
||||
<script>
|
||||
|
@ -54,12 +56,12 @@ var template = [
|
|||
},
|
||||
{
|
||||
label: 'Hide Electron',
|
||||
accelerator: 'Command+H',
|
||||
accelerator: 'CmdOrCtrl+H',
|
||||
selector: 'hide:'
|
||||
},
|
||||
{
|
||||
label: 'Hide Others',
|
||||
accelerator: 'Command+Shift+H',
|
||||
accelerator: 'CmdOrCtrl+Shift+H',
|
||||
selector: 'hideOtherApplications:'
|
||||
},
|
||||
{
|
||||
|
@ -71,7 +73,7 @@ var template = [
|
|||
},
|
||||
{
|
||||
label: 'Quit',
|
||||
accelerator: 'Command+Q',
|
||||
accelerator: 'CmdOrCtrl+Q',
|
||||
selector: 'terminate:'
|
||||
},
|
||||
]
|
||||
|
@ -81,12 +83,12 @@ var template = [
|
|||
submenu: [
|
||||
{
|
||||
label: 'Undo',
|
||||
accelerator: 'Command+Z',
|
||||
accelerator: 'CmdOrCtrl+Z',
|
||||
selector: 'undo:'
|
||||
},
|
||||
{
|
||||
label: 'Redo',
|
||||
accelerator: 'Shift+Command+Z',
|
||||
accelerator: 'Shift+CmdOrCtrl+Z',
|
||||
selector: 'redo:'
|
||||
},
|
||||
{
|
||||
|
@ -94,22 +96,22 @@ var template = [
|
|||
},
|
||||
{
|
||||
label: 'Cut',
|
||||
accelerator: 'Command+X',
|
||||
accelerator: 'CmdOrCtrl+X',
|
||||
selector: 'cut:'
|
||||
},
|
||||
{
|
||||
label: 'Copy',
|
||||
accelerator: 'Command+C',
|
||||
accelerator: 'CmdOrCtrl+C',
|
||||
selector: 'copy:'
|
||||
},
|
||||
{
|
||||
label: 'Paste',
|
||||
accelerator: 'Command+V',
|
||||
accelerator: 'CmdOrCtrl+V',
|
||||
selector: 'paste:'
|
||||
},
|
||||
{
|
||||
label: 'Select All',
|
||||
accelerator: 'Command+A',
|
||||
accelerator: 'CmdOrCtrl+A',
|
||||
selector: 'selectAll:'
|
||||
}
|
||||
]
|
||||
|
@ -119,12 +121,12 @@ var template = [
|
|||
submenu: [
|
||||
{
|
||||
label: 'Reload',
|
||||
accelerator: 'Command+R',
|
||||
accelerator: 'CmdOrCtrl+R',
|
||||
click: function() { remote.getCurrentWindow().reload(); }
|
||||
},
|
||||
{
|
||||
label: 'Toggle DevTools',
|
||||
accelerator: 'Alt+Command+I',
|
||||
accelerator: 'Alt+CmdOrCtrl+I',
|
||||
click: function() { remote.getCurrentWindow().toggleDevTools(); }
|
||||
},
|
||||
]
|
||||
|
@ -134,12 +136,12 @@ var template = [
|
|||
submenu: [
|
||||
{
|
||||
label: 'Minimize',
|
||||
accelerator: 'Command+M',
|
||||
accelerator: 'CmdOrCtrl+M',
|
||||
selector: 'performMiniaturize:'
|
||||
},
|
||||
{
|
||||
label: 'Close',
|
||||
accelerator: 'Command+W',
|
||||
accelerator: 'CmdOrCtrl+W',
|
||||
selector: 'performClose:'
|
||||
},
|
||||
{
|
||||
|
|
|
@ -139,3 +139,7 @@ Returns the size of the image.
|
|||
* `option` Boolean
|
||||
|
||||
Marks the image as template image.
|
||||
|
||||
### NativeImage.isTemplateImage()
|
||||
|
||||
Returns whether the image is a template image.
|
||||
|
|
|
@ -20,7 +20,8 @@ var win = new BrowserWindow({ width: 800, height: 600 });
|
|||
win.loadUrl('https://github.com');
|
||||
```
|
||||
|
||||
Note: for the reverse (access renderer process from main process), you can use [webContents.executeJavascript](https://github.com/atom/electron/blob/master/docs/api/browser-window.md#browserwindowwebcontents).
|
||||
Note: for the reverse (access renderer process from main process), you can use
|
||||
[webContents.executeJavascript](browser-window.md#webcontents-executejavascript-code).
|
||||
|
||||
## Remote objects
|
||||
|
||||
|
|
|
@ -47,7 +47,11 @@ Creates a new tray icon associated with the `image`.
|
|||
|
||||
### Event: 'clicked'
|
||||
|
||||
* `event`
|
||||
* `event` Event
|
||||
* `altKey` Boolean
|
||||
* `shiftKey` Boolean
|
||||
* `ctrlKey` Boolean
|
||||
* `metaKey` Boolean
|
||||
* `bounds` Object - the bounds of tray icon
|
||||
* `x` Integer
|
||||
* `y` Integer
|
||||
|
@ -56,11 +60,15 @@ Creates a new tray icon associated with the `image`.
|
|||
|
||||
Emitted when the tray icon is clicked.
|
||||
|
||||
__Note:__ The `bounds` payload is only implemented on OS X and Windows 7 or newer.
|
||||
__Note:__ The `bounds` payload is only implemented on OS X and Windows.
|
||||
|
||||
### Event: 'right-clicked'
|
||||
|
||||
* `event`
|
||||
* `event` Event
|
||||
* `altKey` Boolean
|
||||
* `shiftKey` Boolean
|
||||
* `ctrlKey` Boolean
|
||||
* `metaKey` Boolean
|
||||
* `bounds` Object - the bounds of tray icon
|
||||
* `x` Integer
|
||||
* `y` Integer
|
||||
|
@ -69,14 +77,24 @@ __Note:__ The `bounds` payload is only implemented on OS X and Windows 7 or newe
|
|||
|
||||
Emitted when the tray icon is right clicked.
|
||||
|
||||
__Note:__ This is only implemented on OS X and Windows. On Windows, this event
|
||||
will be emitted if the tray icon has context menu.
|
||||
__Note:__ This is only implemented on OS X and Windows.
|
||||
|
||||
### Event: 'double-clicked'
|
||||
|
||||
* `event` Event
|
||||
* `altKey` Boolean
|
||||
* `shiftKey` Boolean
|
||||
* `ctrlKey` Boolean
|
||||
* `metaKey` Boolean
|
||||
* `bounds` Object - the bounds of tray icon
|
||||
* `x` Integer
|
||||
* `y` Integer
|
||||
* `width` Integer
|
||||
* `height` Integer
|
||||
|
||||
Emitted when the tray icon is double clicked.
|
||||
|
||||
__Note:__ This is only implemented on OS X.
|
||||
__Note:__ This is only implemented on OS X and Windows.
|
||||
|
||||
### Event: 'balloon-show'
|
||||
|
||||
|
@ -155,15 +173,16 @@ Displays a tray balloon.
|
|||
|
||||
__Note:__ This is only implemented on Windows.
|
||||
|
||||
### Tray.popContextMenu([position])
|
||||
### Tray.popUpContextMenu([position])
|
||||
|
||||
* `position` Object - The pop position
|
||||
* `x` Integer
|
||||
* `y` Integer
|
||||
|
||||
__Note:__ This is only implemented on OS X and Windows.
|
||||
The `position` is only available on Windows, and it is (0, 0) by default.
|
||||
|
||||
__Note:__ This is only implemented on OS X and Windows.
|
||||
|
||||
### Tray.setContextMenu(menu)
|
||||
|
||||
* `menu` Menu
|
||||
|
|
|
@ -57,10 +57,17 @@ require('web-frame').setSpellCheckProvider("en-US", true, {
|
|||
|
||||
* `scheme` String
|
||||
|
||||
Sets the `scheme` as secure scheme.
|
||||
Registers the `scheme` as secure scheme.
|
||||
|
||||
Secure schemes do not trigger mixed content warnings. For example, `https` and
|
||||
`data` are secure schemes because they cannot be corrupted by active network
|
||||
attackers.
|
||||
|
||||
## webFrame.registerUrlSchemeAsBypassingCsp(scheme)
|
||||
|
||||
* `scheme` String
|
||||
|
||||
Resources will be loaded from this `scheme` regardless of
|
||||
page's Content Security Policy.
|
||||
|
||||
[spellchecker]: https://github.com/atom/node-spellchecker
|
||||
|
|
|
@ -130,10 +130,10 @@ If "on", the guest page will have web security disabled.
|
|||
|
||||
## Methods
|
||||
|
||||
The webview element must be loaded before using the methods.
|
||||
The webview element must be loaded before using the methods.
|
||||
**Example**
|
||||
```javascript
|
||||
webview.addEventListener("dom-ready", function(){
|
||||
webview.addEventListener("dom-ready", function() {
|
||||
webview.openDevTools();
|
||||
});
|
||||
```
|
||||
|
@ -225,11 +225,14 @@ Returns a `String` represents the user agent for guest page.
|
|||
|
||||
Injects CSS into guest page.
|
||||
|
||||
### `<webview>`.executeJavaScript(code)
|
||||
### `<webview>`.executeJavaScript(code, userGesture)
|
||||
|
||||
* `code` String
|
||||
* `userGesture` Boolean - Default false
|
||||
|
||||
Evaluates `code` in guest page.
|
||||
Evaluates `code` in page. If `userGesture` is set will create user gesture context,
|
||||
HTML api like `requestFullScreen` which require user action can take advantage
|
||||
of this option for automation.
|
||||
|
||||
### `<webview>`.openDevTools()
|
||||
|
||||
|
@ -312,11 +315,11 @@ Executes editing command `replace` in page.
|
|||
|
||||
Executes editing command `replaceMisspelling` in page.
|
||||
|
||||
### `<webview>.print([options])`
|
||||
### `<webview>`.print([options])
|
||||
|
||||
Prints webview's web page. Same with `webContents.print([options])`.
|
||||
|
||||
### `<webview>.printToPDF(options, callback)`
|
||||
### `<webview>`.printToPDF(options, callback)
|
||||
|
||||
Prints webview's web page as PDF, Same with `webContents.printToPDF(options, callback)`
|
||||
|
||||
|
@ -332,6 +335,15 @@ examples.
|
|||
|
||||
## DOM events
|
||||
|
||||
### load-commit
|
||||
|
||||
* `url` String
|
||||
* `isMainFrame` Boolean
|
||||
|
||||
Fired when a load has committed. This includes navigation within the current
|
||||
document as well as subframe document-level loads, but does not include
|
||||
asynchronous resource loads.
|
||||
|
||||
### did-finish-load
|
||||
|
||||
Fired when the navigation is done, i.e. the spinner of the tab will stop
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue