Merge pull request #6980 from electron/method-params-take-2

Document all Method Parameters
This commit is contained in:
Zeke Sikelianos 2016-08-25 11:25:01 -07:00 committed by GitHub
commit 9548184b15
7 changed files with 64 additions and 31 deletions

View file

@ -684,6 +684,9 @@ details.
### `app.commandLine.appendSwitch(switch[, value])`
* `switch` String - A command-line switch
* `value` String (optional) - A value for the given switch
Append a switch (with optional `value`) to Chromium's command line.
**Note:** This will not affect `process.argv`, and is mainly used by developers
@ -691,6 +694,8 @@ to control some low-level Chromium behaviors.
### `app.commandLine.appendArgument(value)`
* `value` String - The argument to append to the command line
Append an argument to Chromium's command line. The argument will be quoted
correctly.

View file

@ -944,10 +944,23 @@ Whether the window's document has been edited.
#### `win.capturePage([rect, ]callback)`
* `rect` Object (optional) - The area of the page to be captured
* `x` Integer
* `y` Integer
* `width` Integer
* `height` Integer
* `callback` Function
Same as `webContents.capturePage([rect, ]callback)`.
#### `win.loadURL(url[, options])`
* `url` URL
* `options` Object (optional)
* `httpReferrer` String - A HTTP Referrer url.
* `userAgent` String - A user agent originating the request.
* `extraHeaders` String - Extra headers separated by "\n"
Same as `webContents.loadURL(url[, options])`.
The `url` can be a remote address (e.g. `http://`) or a path to a local
@ -1137,6 +1150,8 @@ events.
#### `win.setContentProtection(enable)` _macOS_ _Windows_
* `enable` Boolean
Prevents the window contents from being captured by other apps.
On macOS it sets the NSWindow's sharingType to NSWindowSharingNone.

View file

@ -119,6 +119,9 @@ will be passed via `callback(response)`.
### `dialog.showErrorBox(title, content)`
* `title` String - The title to display in the error box
* `content` String - The text content to display in the error box
Displays a modal dialog that shows an error message.
This API can be called safely before the `ready` event the `app` module emits,

View file

@ -152,9 +152,11 @@ Returns the [`WebContents`](web-contents.md) object of this web page.
Returns the global variable of `name` (e.g. `global[name]`) in the main
process.
## Properties
### `remote.process`
Returns the `process` object in the main process. This is the same as
The `process` object in the main process. This is the same as
`remote.getGlobal('process')` but is cached.
[rmi]: http://en.wikipedia.org/wiki/Java_remote_method_invocation

View file

@ -62,11 +62,16 @@ Removes the subscriber with `id`.
### `systemPreferences.subscribeLocalNotification(event, callback)` _macOS_
* `event` String
* `callback` Function
Same as `subscribeNotification`, but uses `NSNotificationCenter` for local defaults.
This is necessary for events such as `NSUserDefaultsDidChangeNotification`
### `systemPreferences.unsubscribeLocalNotification(id)` _macOS_
* `id` Integer
Same as `unsubscribeNotification`, but removes the subscriber from `NSNotificationCenter`.
### `systemPreferences.getUserDefault(key, type)` _macOS_

View file

@ -974,12 +974,11 @@ app.on('ready', () => {
#### `contents.enableDeviceEmulation(parameters)`
`parameters` Object, properties:
* `parameters` Object
* `screenPosition` String - Specify the screen type to emulate
(default: `desktop`)
* `desktop` - Desktop screen type
* `mobile` - Mobile screen type
* `desktop` String - Desktop screen type
* `mobile` String - Mobile screen type
* `screenSize` Object - Set the emulated screen size (screenPosition == mobile)
* `width` Integer - Set the emulated screen width
* `height` Integer - Set the emulated screen height
@ -987,7 +986,7 @@ app.on('ready', () => {
(screenPosition == mobile) (default: `{x: 0, y: 0}`)
* `x` Integer - Set the x axis offset from top left corner
* `y` Integer - Set the y axis offset from top left corner
* `deviceScaleFactor` Float - Set the device scale factor (if zero defaults to
* `deviceScaleFactor` Integer - Set the device scale factor (if zero defaults to
original device scale factor) (default: `0`)
* `viewSize` Object - Set the emulated view size (empty means no override)
* `width` Integer - Set the emulated view width

View file

@ -53,10 +53,6 @@ Removes focus from the child window.
Forcefully closes the child window without calling its unload event.
#### `win.closed`
Set to true after the child window gets closed.
#### `win.eval(code)`
* `code` String
@ -81,3 +77,11 @@ origin preference.
In addition to these methods, the child window implements `window.opener` object
with no properties and a single method.
### Instance Properties
The `BrowserWindowProxy` object has the following instance properties:
#### `win.closed`
Set to true after the child window gets closed.