Text edits per commit comments
This commit is contained in:
parent
bc909ddf5e
commit
00de81771c
3 changed files with 37 additions and 32 deletions
|
@ -14,7 +14,7 @@ win.loadUrl('https://github.com');
|
|||
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.
|
||||
|
||||
## Class: BrowserWindow
|
||||
|
@ -146,7 +146,7 @@ window.onbeforeunload = function(e) {
|
|||
|
||||
// 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.
|
||||
// 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.
|
||||
e.returnValue = false;
|
||||
};
|
||||
|
@ -295,7 +295,7 @@ Objects created with `new BrowserWindow` have the following instance methods:
|
|||
var BrowserWindow = require('browser-window');
|
||||
|
||||
// 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)`
|
||||
|
||||
`buttons` Array od `button` Objects:
|
||||
`buttons` Array of `button` Objects:
|
||||
|
||||
`button` Object, properties:
|
||||
|
||||
|
@ -688,7 +688,7 @@ __Note:__ This API is only available on Windows (Windows 7 and above)
|
|||
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.
|
||||
state indicating 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.
|
||||
|
|
|
@ -5,7 +5,7 @@ The `session` object is a property of [`webContents`](web-contents.md) which is
|
|||
```javascript
|
||||
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");
|
||||
|
||||
var session = win.webContents.session
|
||||
|
@ -17,7 +17,7 @@ The `session` object has the following methods:
|
|||
|
||||
### 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
|
||||
var BrowserWindow = require('browser-window');
|
||||
|
@ -33,7 +33,7 @@ win.webContents.on('did-finish-load', function() {
|
|||
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" },
|
||||
function(error, cookies) {
|
||||
if (error) throw error;
|
||||
|
|
|
@ -8,7 +8,7 @@ It is responsible for rendering and controlling a web page and is a property of
|
|||
```javascript
|
||||
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");
|
||||
|
||||
var webContents = win.webContents
|
||||
|
@ -163,7 +163,7 @@ See [session documentation](session.md) for this object's methods.
|
|||
* `httpReferrer` String - A HTTP Referrer url
|
||||
* `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://`.
|
||||
|
||||
### `webContents.getUrl()`
|
||||
|
@ -177,11 +177,11 @@ win.loadUrl("http://github.com");
|
|||
var currentUrl = win.webContents.getUrl();
|
||||
```
|
||||
|
||||
Returns URL of current web page.
|
||||
Returns URL of the current web page.
|
||||
|
||||
### `webContents.getTitle()`
|
||||
|
||||
Returns the title of web page.
|
||||
Returns the title of the current web page.
|
||||
|
||||
### `webContents.isLoading()`
|
||||
|
||||
|
@ -189,7 +189,7 @@ Returns whether web page is still loading resources.
|
|||
|
||||
### `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.
|
||||
|
||||
### `webContents.stop()`
|
||||
|
@ -198,7 +198,7 @@ Stops any pending navigation.
|
|||
|
||||
### `webContents.reload()`
|
||||
|
||||
Reloads current page.
|
||||
Reloads the current web page.
|
||||
|
||||
### `webContents.reloadIgnoringCache()`
|
||||
|
||||
|
@ -206,11 +206,11 @@ Reloads current page and ignores cache.
|
|||
|
||||
### `webContents.canGoBack()`
|
||||
|
||||
Returns whether the web page can go back.
|
||||
Returns whether the browser can go back to previous web page.
|
||||
|
||||
### `webContents.canGoForward()`
|
||||
|
||||
Returns whether the web page can go forward.
|
||||
Returns whether the browser can go forward to next web page.
|
||||
|
||||
### `webContents.canGoToOffset(offset)`
|
||||
|
||||
|
@ -224,17 +224,17 @@ Clears the navigation history.
|
|||
|
||||
### `webContents.goBack()`
|
||||
|
||||
Makes the web page go back.
|
||||
Makes the browser go back a web page.
|
||||
|
||||
### `webContents.goForward()`
|
||||
|
||||
Makes the web page go forward.
|
||||
Makes the browser go forward a web page.
|
||||
|
||||
### `webContents.goToIndex(index)`
|
||||
|
||||
* `index` Integer
|
||||
|
||||
Navigates to the specified absolute index.
|
||||
Navigates browser to the specified absolute web page index.
|
||||
|
||||
### `webContents.goToOffset(offset)`
|
||||
|
||||
|
@ -254,13 +254,13 @@ Overrides the user agent for this page.
|
|||
|
||||
### `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)`
|
||||
|
||||
* `css` String
|
||||
|
||||
Injects CSS into this page.
|
||||
Injects CSS into the current web page.
|
||||
|
||||
### `webContents.executeJavaScript(code[, userGesture])`
|
||||
|
||||
|
@ -269,15 +269,13 @@ Injects CSS into this page.
|
|||
|
||||
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.
|
||||
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.
|
||||
|
||||
### `webContents.setAudioMuted(muted)`
|
||||
|
||||
+ `muted` Boolean
|
||||
|
||||
Set the page muted.
|
||||
Mute the audio on the current web page.
|
||||
|
||||
### `webContents.isAudioMuted()`
|
||||
|
||||
|
@ -335,15 +333,15 @@ Executes editing command `replaceMisspelling` in page.
|
|||
|
||||
* `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`.
|
||||
|
||||
### `webContents.unregisterServiceWorker(callback)`
|
||||
|
||||
* `callback` Function
|
||||
|
||||
Unregisters any serviceworker if present and returns boolean as
|
||||
response to `callback` when the JS promise is fullfilled or false
|
||||
Unregisters any ServiceWorker if present and returns a boolean as
|
||||
response to `callback` when the JS promise is fulfilled or false
|
||||
when the JS promise is rejected.
|
||||
|
||||
### `webContents.print([options])`
|
||||
|
@ -361,7 +359,7 @@ Calling `window.print()` in web page is equivalent to call
|
|||
`webContents.print({silent: false, printBackground: false})`.
|
||||
|
||||
**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.
|
||||
|
||||
### `webContents.printToPDF(options, callback)`
|
||||
|
@ -390,9 +388,16 @@ size.
|
|||
Prints window's web page as PDF with Chromium's preview printing custom
|
||||
settings.
|
||||
|
||||
By default, an empty `options` will be regarded as
|
||||
`{marginsType:0, printBackgrounds:false, printSelectionOnly:false,
|
||||
landscape:false}`.
|
||||
By default, an empty `options` will be regarded as:
|
||||
|
||||
```javascript
|
||||
{
|
||||
marginsType:0,
|
||||
printBackgrounds:false,
|
||||
printSelectionOnly:false,
|
||||
landscape:false
|
||||
}
|
||||
```
|
||||
|
||||
```javascript
|
||||
var BrowserWindow = require('browser-window');
|
||||
|
|
Loading…
Reference in a new issue