Text edits per commit comments

This commit is contained in:
Jessica Lord 2015-08-20 19:03:53 +02:00
parent bc909ddf5e
commit 00de81771c
3 changed files with 37 additions and 32 deletions

View file

@ -14,7 +14,7 @@ win.loadUrl('https://github.com');
win.show(); win.show();
``` ```
You can also create a window without Chrome by using You can also create a window without chrome by using
[Frameless Window](frameless-window.md) API. [Frameless Window](frameless-window.md) API.
## Class: BrowserWindow ## Class: BrowserWindow
@ -146,7 +146,7 @@ window.onbeforeunload = function(e) {
// Unlike usual browsers, in which a string should be returned and the user is // Unlike usual browsers, in which a string should be returned and the user is
// prompted to confirm the page unload, Electron gives developers more options. // prompted to confirm the page unload, Electron gives developers more options.
// Returning an empty string or false will prevent the unloading. // Returning an empty string or `false` will prevent the unloading.
// You can also use the dialog API to let the user confirm closing the application. // You can also use the dialog API to let the user confirm closing the application.
e.returnValue = false; e.returnValue = false;
}; };
@ -295,7 +295,7 @@ Objects created with `new BrowserWindow` have the following instance methods:
var BrowserWindow = require('browser-window'); var BrowserWindow = require('browser-window');
// In this example `win` is our instance // In this example `win` is our instance
var win = new BroswerWindow({width: 800, height: 1500}); var win = new BrowserWindow({ width: 800, height: 600 });
``` ```
@ -676,7 +676,7 @@ __Note:__ This API is only available on Windows (Windows 7 and above)
### `win.setThumbarButtons(buttons)` ### `win.setThumbarButtons(buttons)`
`buttons` Array od `button` Objects: `buttons` Array of `button` Objects:
`button` Object, properties: `button` Object, properties:
@ -688,7 +688,7 @@ __Note:__ This API is only available on Windows (Windows 7 and above)
Strings: Strings:
* `enabled` - The button is active and available to the user. * `enabled` - The button is active and available to the user.
* `disabled` - The button is disabled. It is present, but has a visual * `disabled` - The button is disabled. It is present, but has a visual
state that indicates that it will not respond to user action. state indicating it will not respond to user action.
* `dismissonclick` - When the button is clicked, the taskbar button's * `dismissonclick` - When the button is clicked, the taskbar button's
flyout closes immediately. flyout closes immediately.
* `nobackground` - Do not draw a button border, use only the image. * `nobackground` - Do not draw a button border, use only the image.

View file

@ -5,7 +5,7 @@ The `session` object is a property of [`webContents`](web-contents.md) which is
```javascript ```javascript
var BrowserWindow = require('browser-window'); var BrowserWindow = require('browser-window');
var win = new BroswerWindow({ width: 800, height: 600 }); var win = new BrowserWindow({ width: 800, height: 600 });
win.loadUrl("http://github.com"); win.loadUrl("http://github.com");
var session = win.webContents.session var session = win.webContents.session
@ -17,7 +17,7 @@ The `session` object has the following methods:
### session.cookies ### session.cookies
The `cookies` gives you ability to query and modify cookies, an example is: The `cookies` gives you ability to query and modify cookies. For example:
```javascript ```javascript
var BrowserWindow = require('browser-window'); var BrowserWindow = require('browser-window');
@ -33,7 +33,7 @@ win.webContents.on('did-finish-load', function() {
console.log(cookies); console.log(cookies);
}); });
// Query all cookies that are associated with a specific url. // Query all cookies associated with a specific url.
win.webContents.session.cookies.get({ url : "http://www.github.com" }, win.webContents.session.cookies.get({ url : "http://www.github.com" },
function(error, cookies) { function(error, cookies) {
if (error) throw error; if (error) throw error;

View file

@ -8,7 +8,7 @@ It is responsible for rendering and controlling a web page and is a property of
```javascript ```javascript
var BrowserWindow = require('browser-window'); var BrowserWindow = require('browser-window');
var win = new BroswerWindow({width: 800, height: 1500}); var win = new BrowserWindow({width: 800, height: 1500});
win.loadUrl("http://github.com"); win.loadUrl("http://github.com");
var webContents = win.webContents var webContents = win.webContents
@ -163,7 +163,7 @@ See [session documentation](session.md) for this object's methods.
* `httpReferrer` String - A HTTP Referrer url * `httpReferrer` String - A HTTP Referrer url
* `userAgent` String - A user agent originating the request * `userAgent` String - A user agent originating the request
Loads the `url` in the window, the `url` must contains the protocol prefix, Loads the `url` in the window, the `url` must contain the protocol prefix,
e.g. the `http://` or `file://`. e.g. the `http://` or `file://`.
### `webContents.getUrl()` ### `webContents.getUrl()`
@ -177,11 +177,11 @@ win.loadUrl("http://github.com");
var currentUrl = win.webContents.getUrl(); var currentUrl = win.webContents.getUrl();
``` ```
Returns URL of current web page. Returns URL of the current web page.
### `webContents.getTitle()` ### `webContents.getTitle()`
Returns the title of web page. Returns the title of the current web page.
### `webContents.isLoading()` ### `webContents.isLoading()`
@ -189,7 +189,7 @@ Returns whether web page is still loading resources.
### `webContents.isWaitingForResponse()` ### `webContents.isWaitingForResponse()`
Returns whether web page is waiting for a first-response for the main resource Returns whether the web page is waiting for a first-response for the main resource
of the page. of the page.
### `webContents.stop()` ### `webContents.stop()`
@ -198,7 +198,7 @@ Stops any pending navigation.
### `webContents.reload()` ### `webContents.reload()`
Reloads current page. Reloads the current web page.
### `webContents.reloadIgnoringCache()` ### `webContents.reloadIgnoringCache()`
@ -206,11 +206,11 @@ Reloads current page and ignores cache.
### `webContents.canGoBack()` ### `webContents.canGoBack()`
Returns whether the web page can go back. Returns whether the browser can go back to previous web page.
### `webContents.canGoForward()` ### `webContents.canGoForward()`
Returns whether the web page can go forward. Returns whether the browser can go forward to next web page.
### `webContents.canGoToOffset(offset)` ### `webContents.canGoToOffset(offset)`
@ -224,17 +224,17 @@ Clears the navigation history.
### `webContents.goBack()` ### `webContents.goBack()`
Makes the web page go back. Makes the browser go back a web page.
### `webContents.goForward()` ### `webContents.goForward()`
Makes the web page go forward. Makes the browser go forward a web page.
### `webContents.goToIndex(index)` ### `webContents.goToIndex(index)`
* `index` Integer * `index` Integer
Navigates to the specified absolute index. Navigates browser to the specified absolute web page index.
### `webContents.goToOffset(offset)` ### `webContents.goToOffset(offset)`
@ -254,13 +254,13 @@ Overrides the user agent for this page.
### `webContents.getUserAgent()` ### `webContents.getUserAgent()`
Returns a `String` represents the user agent for this page. Returns a `String` representing the user agent for this page.
### `webContents.insertCSS(css)` ### `webContents.insertCSS(css)`
* `css` String * `css` String
Injects CSS into this page. Injects CSS into the current web page.
### `webContents.executeJavaScript(code[, userGesture])` ### `webContents.executeJavaScript(code[, userGesture])`
@ -269,15 +269,13 @@ Injects CSS into this page.
Evaluates `code` in page. Evaluates `code` in page.
In browser some HTML APIs like `requestFullScreen` can only be invoked if it In the browser window some HTML APIs like `requestFullScreen` can only be invoked by a gesture from the user. Setting `userGesture` to `true` will remove this limitation.
is started by user gesture, by specifying `userGesture` to `true` developers
can ignore this limitation.
### `webContents.setAudioMuted(muted)` ### `webContents.setAudioMuted(muted)`
+ `muted` Boolean + `muted` Boolean
Set the page muted. Mute the audio on the current web page.
### `webContents.isAudioMuted()` ### `webContents.isAudioMuted()`
@ -335,15 +333,15 @@ Executes editing command `replaceMisspelling` in page.
* `callback` Function * `callback` Function
Checks if any serviceworker is registered and returns boolean as Checks if any ServiceWorker is registered and returns a boolean as
response to `callback`. response to `callback`.
### `webContents.unregisterServiceWorker(callback)` ### `webContents.unregisterServiceWorker(callback)`
* `callback` Function * `callback` Function
Unregisters any serviceworker if present and returns boolean as Unregisters any ServiceWorker if present and returns a boolean as
response to `callback` when the JS promise is fullfilled or false response to `callback` when the JS promise is fulfilled or false
when the JS promise is rejected. when the JS promise is rejected.
### `webContents.print([options])` ### `webContents.print([options])`
@ -361,7 +359,7 @@ Calling `window.print()` in web page is equivalent to call
`webContents.print({silent: false, printBackground: false})`. `webContents.print({silent: false, printBackground: false})`.
**Note:** On Windows, the print API relies on `pdf.dll`. If your application **Note:** On Windows, the print API relies on `pdf.dll`. If your application
doesn't need print feature, you can safely remove `pdf.dll` in saving binary doesn't need the print feature, you can safely remove `pdf.dll` to reduce binary
size. size.
### `webContents.printToPDF(options, callback)` ### `webContents.printToPDF(options, callback)`
@ -390,9 +388,16 @@ size.
Prints window's web page as PDF with Chromium's preview printing custom Prints window's web page as PDF with Chromium's preview printing custom
settings. settings.
By default, an empty `options` will be regarded as By default, an empty `options` will be regarded as:
`{marginsType:0, printBackgrounds:false, printSelectionOnly:false,
landscape:false}`. ```javascript
{
marginsType:0,
printBackgrounds:false,
printSelectionOnly:false,
landscape:false
}
```
```javascript ```javascript
var BrowserWindow = require('browser-window'); var BrowserWindow = require('browser-window');