Line wrap 80
This commit is contained in:
parent
d7fda9c8cc
commit
9b84dc4e1a
3 changed files with 52 additions and 37 deletions
|
@ -2,7 +2,8 @@
|
|||
|
||||
The `app` module is responsible for controlling the application's lifecycle.
|
||||
|
||||
The following example shows how to quit the application when the last window is closed:
|
||||
The following example shows how to quit the application when the last window is
|
||||
closed:
|
||||
|
||||
```javascript
|
||||
var app = require('app');
|
||||
|
@ -19,9 +20,9 @@ The `app` object emits the following events:
|
|||
|
||||
Emitted when the application has finished basic startup. On Windows and Linux,
|
||||
the `will-finish-launching` event is the same as the `ready` event; on OS X,
|
||||
this event represents the `applicationWillFinishLaunching` notification of `NSApplication`.
|
||||
You would usually set up listeners for the `open-file` and `open-url` events here,
|
||||
and start the crash reporter and auto updater.
|
||||
this event represents the `applicationWillFinishLaunching` notification of
|
||||
`NSApplication`. You would usually set up listeners for the `open-file` and
|
||||
`open-url` events here, and start the crash reporter and auto updater.
|
||||
|
||||
In most cases, you should just do everything in the `ready` event handler.
|
||||
|
||||
|
@ -58,7 +59,8 @@ Emitted when all windows have been closed and the application will quit.
|
|||
Calling `event.preventDefault()` will prevent the default behaviour, which is
|
||||
terminating the application.
|
||||
|
||||
See the description of the `window-all-closed` event for the differences between the `will-quit` and `window-all-closed` events.
|
||||
See the description of the `window-all-closed` event for the differences between
|
||||
the `will-quit` and `window-all-closed` events.
|
||||
|
||||
### Event: 'quit'
|
||||
|
||||
|
@ -71,12 +73,12 @@ Returns:
|
|||
* `event` Event
|
||||
* `path` String
|
||||
|
||||
Emitted when the user wants to open a file with the application. The `open-file` event
|
||||
is usually emitted when the application is already open and the OS wants to reuse the
|
||||
application to open the file. `open-file` is also emitted when a file is dropped onto the
|
||||
dock and the application is not yet running. Make sure to listen for the `open-file`
|
||||
event very early in your application startup to handle this case (even before the
|
||||
`ready` event is emitted).
|
||||
Emitted when the user wants to open a file with the application. The `open-file`
|
||||
event is usually emitted when the application is already open and the OS wants
|
||||
to reuse the application to open the file. `open-file` is also emitted when a
|
||||
file is dropped onto the dock and the application is not yet running. Make sure
|
||||
to listen for the `open-file` event very early in your application startup to
|
||||
handle this case (even before the `ready` event is emitted).
|
||||
|
||||
You should call `event.preventDefault()` if you want to handle this event.
|
||||
|
||||
|
@ -95,8 +97,8 @@ You should call `event.preventDefault()` if you want to handle this event.
|
|||
### Event: 'activate-with-no-open-windows'
|
||||
|
||||
Emitted when the application is activated while there are no open windows, which
|
||||
usually happens when the user has closed all of the application's windows and then
|
||||
clicks on the application's dock icon.
|
||||
usually happens when the user has closed all of the application's windows and
|
||||
then clicks on the application's dock icon.
|
||||
|
||||
### Event: 'browser-window-blur'
|
||||
|
||||
|
@ -137,9 +139,10 @@ app.on('select-certificate', function(event, host, url, list, callback) {
|
|||
})
|
||||
```
|
||||
|
||||
The `url` corresponds to the navigation entry requesting the client certificate and `callback` needs to be called with an entry filtered from the list.
|
||||
Using `event.preventDefault()` prevents the application from using the first certificate
|
||||
from the store.
|
||||
The `url` corresponds to the navigation entry requesting the client certificate
|
||||
and `callback` needs to be called with an entry filtered from the list. Using
|
||||
`event.preventDefault()` prevents the application from using the first
|
||||
certificate from the store.
|
||||
|
||||
### Event: 'gpu-process-crashed'
|
||||
|
||||
|
@ -155,9 +158,9 @@ Try to close all windows. The `before-quit` event will emitted first. If all
|
|||
windows are successfully closed, the `will-quit` event will be emitted and by
|
||||
default the application will terminate.
|
||||
|
||||
This method guarantees that all `beforeunload` and `unload` event handlers are correctly
|
||||
executed. It is possible that a window cancels the quitting by returning
|
||||
`false` in the `beforeunload` event handler.
|
||||
This method guarantees that all `beforeunload` and `unload` event handlers are
|
||||
correctly executed. It is possible that a window cancels the quitting by
|
||||
returning `false` in the `beforeunload` event handler.
|
||||
|
||||
### `app.getAppPath()`
|
||||
|
||||
|
@ -208,8 +211,8 @@ directory. If you want to change this location, you have to override the
|
|||
### `app.getVersion()`
|
||||
|
||||
Returns the version of the loaded application. If no version is found in the
|
||||
application's `package.json` file, the version of the current bundle or executable is
|
||||
returned.
|
||||
application's `package.json` file, the version of the current bundle or
|
||||
executable is returned.
|
||||
|
||||
### `app.getName()`
|
||||
|
||||
|
@ -258,8 +261,8 @@ Adds `tasks` to the [Tasks][tasks] category of the JumpList on Windows.
|
|||
* `title` String - The string to be displayed in a JumpList.
|
||||
* `description` String - Description of this task.
|
||||
* `iconPath` String - The absolute path to an icon to be displayed in a
|
||||
JumpList, which can be an arbitrary resource file that contains an icon. You can
|
||||
usually specify `process.execPath` to show the icon of the program.
|
||||
JumpList, which can be an arbitrary resource file that contains an icon. You
|
||||
can usually specify `process.execPath` to show the icon of the program.
|
||||
* `iconIndex` Integer - The icon index in the icon file. If an icon file
|
||||
consists of two or more icons, set this value to identify the icon. If an
|
||||
icon file consists of one icon, this value is 0.
|
||||
|
@ -275,7 +278,8 @@ to control some low-level Chromium behaviors.
|
|||
|
||||
### `app.commandLine.appendArgument(value)`
|
||||
|
||||
Append an argument to Chromium's command line. The argument will be quoted correctly.
|
||||
Append an argument to Chromium's command line. The argument will be quoted
|
||||
correctly.
|
||||
|
||||
**Note:** This will not affect `process.argv`.
|
||||
|
||||
|
@ -287,9 +291,9 @@ Append an argument to Chromium's command line. The argument will be quoted corre
|
|||
When `critical` is passed, the dock icon will bounce until either the
|
||||
application becomes active or the request is canceled.
|
||||
|
||||
When `informational` is passed, the dock icon will bounce for one second. However,
|
||||
the request remains active until either the application becomes active or
|
||||
the request is canceled.
|
||||
When `informational` is passed, the dock icon will bounce for one second.
|
||||
However, the request remains active until either the application becomes active
|
||||
or the request is canceled.
|
||||
|
||||
Returns an ID representing the request.
|
||||
|
||||
|
|
|
@ -135,8 +135,8 @@ Returns:
|
|||
* `updateUrl` String
|
||||
* `quitAndUpdate` Function
|
||||
|
||||
Emitted when an update has been downloaded. Calling `quitAndUpdate()` will restart
|
||||
the application and install the update.
|
||||
Emitted when an update has been downloaded. Calling `quitAndUpdate()` will
|
||||
restart the application and install the update.
|
||||
|
||||
## Methods
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# Electron Documentation Styleguide
|
||||
|
||||
Find the appropriate section for your task: [reading Electron documentation](#) or [writing Electron documentation](#).
|
||||
Find the appropriate section for your task: [reading Electron documentation](#)
|
||||
or [writing Electron documentation](#).
|
||||
|
||||
## Writing Electron Documentation
|
||||
|
||||
|
@ -8,12 +9,14 @@ These are the ways that we construct the Electron documentation.
|
|||
|
||||
- Maximum one `h1` title per page.
|
||||
- Use `bash` instead of `cmd` in code blocks (because of syntax highlighter).
|
||||
- Doc `h1` titles should match object name (i.e. `browser-window` → `BrowserWindow`).
|
||||
- Doc `h1` titles should match object name (i.e. `browser-window` →
|
||||
`BrowserWindow`).
|
||||
- Hyphen separated filenames, however, are fine.
|
||||
- No headers following headers, add at least a one-sentence description.
|
||||
- Methods headers are wrapped in `code` ticks.
|
||||
- Event headers are wrapped in singe 'quotation' marks.
|
||||
- No nesting lists more than 2 levels (unfortunately because of markdown renderer).
|
||||
- No nesting lists more than 2 levels (unfortunately because of markdown
|
||||
renderer).
|
||||
- Add section titles: Events, Class Methods and Instance Methods.
|
||||
- Use 'will' over 'would' when describing outcomes.
|
||||
- Events and methods are `h3` headers.
|
||||
|
@ -25,7 +28,8 @@ Here are some tips for understanding Electron documentation syntax.
|
|||
|
||||
### Methods
|
||||
|
||||
An example of [method](https://developer.mozilla.org/en-US/docs/Glossary/Method) documentation:
|
||||
An example of [method](https://developer.mozilla.org/en-US/docs/Glossary/Method)
|
||||
documentation:
|
||||
|
||||
---
|
||||
|
||||
|
@ -36,13 +40,18 @@ An example of [method](https://developer.mozilla.org/en-US/docs/Glossary/Method)
|
|||
|
||||
---
|
||||
|
||||
The method name is followed by the arguments it takes. Optional arguments are notated by brackets surrounding the optional argument as well as the comma required if this optional argument follows another argument.
|
||||
The method name is followed by the arguments it takes. Optional arguments are
|
||||
notated by brackets surrounding the optional argument as well as the comma
|
||||
required if this optional argument follows another argument.
|
||||
|
||||
Below the method is more detailed information on each of the arguments. The type of argument is notated by either the common types: [`String`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String), [`Number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number), [`Object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object), [`Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) or a custom type like Electron's [`webContent`](api/web-content.md).
|
||||
Below the method is more detailed information on each of the arguments. The type
|
||||
of argument is notated by either the common types: [`String`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String), [`Number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number), [`Object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object), [`Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)
|
||||
or a custom type like Electron's [`webContent`](api/web-content.md).
|
||||
|
||||
### Events
|
||||
|
||||
An example of [event](https://developer.mozilla.org/en-US/docs/Web/API/Event) documentation:
|
||||
An example of [event](https://developer.mozilla.org/en-US/docs/Web/API/Event)
|
||||
documentation:
|
||||
|
||||
---
|
||||
|
||||
|
@ -54,7 +63,9 @@ Returns:
|
|||
|
||||
---
|
||||
|
||||
The event is a string that is used after a `.on` listener method. If it returns a value it and its type is noted below. If you were to listen and respond to this event it might look something like this:
|
||||
The event is a string that is used after a `.on` listener method. If it returns
|
||||
a value it and its type is noted below. If you were to listen and respond to
|
||||
this event it might look something like this:
|
||||
|
||||
```javascript
|
||||
Alarm.on('wake-up', function(time) {
|
||||
|
|
Loading…
Reference in a new issue