This commit is contained in:
eaton11 2015-06-10 19:28:14 -06:00
commit d367af3fa4
40 changed files with 283 additions and 171 deletions

View file

@ -43,7 +43,7 @@ You can also create a window without chrome by using
other windows
* `fullscreen` Boolean - Whether the window should show in fullscreen, when
set to `false` the fullscreen button would also be hidden on OS X
* `skip-taskbar` Boolean - Do not show window in Taskbar
* `skip-taskbar` Boolean - Do not show window in taskbar
* `zoom-factor` Number - The default zoom factor of the page, zoom factor is
zoom percent / 100, so `3.0` represents `300%`
* `kiosk` Boolean - The kiosk mode
@ -131,9 +131,9 @@ window.onbeforeunload = function(e) {
console.log('I do not want to be closed');
// Unlike usual browsers, in which a string should be returned and the user is
// prompted to confirm the page unload. Electron gives the power completely
// to the developers, return empty string or false would prevent the unloading
// now. You can also use the dialog API to let user confirm it.
// prompted to confirm the page unload, Electron gives developers more options.
// Returning empty string or false would prevent the unloading now.
// You can also use the dialog API to let the user confirm closing the application.
return false;
};
```
@ -464,7 +464,7 @@ Starts or stops flashing the window to attract user's attention.
* `skip` Boolean
Makes the window do not show in Taskbar.
Makes the window not show in the taskbar.
### BrowserWindow.setKiosk(flag)
@ -483,13 +483,13 @@ Returns whether the window is in kiosk mode.
Sets the pathname of the file the window represents, and the icon of the file
will show in window's title bar.
__Note__: This API is available only on OS X.
__Note__: This API is only available on OS X.
### BrowserWindow.getRepresentedFilename()
Returns the pathname of the file the window represents.
__Note__: This API is available only on OS X.
__Note__: This API is only available on OS X.
### BrowserWindow.setDocumentEdited(edited)
@ -498,13 +498,13 @@ __Note__: This API is available only on OS X.
Specifies whether the windows document has been edited, and the icon in title
bar will become grey when set to `true`.
__Note__: This API is available only on OS X.
__Note__: This API is only available on OS X.
### BrowserWindow.IsDocumentEdited()
Whether the window's document has been edited.
__Note__: This API is available only on OS X.
__Note__: This API is only available on OS X.
### BrowserWindow.openDevTools([options])
@ -604,20 +604,20 @@ it will assume `app.getName().desktop`.
### BrowserWindow.setOverlayIcon(overlay, description)
* `overlay` [NativeImage](native-image.md) - the icon to display on the bottom
right corner of the Taskbar icon. If this parameter is `null`, the overlay is
right corner of the taskbar icon. If this parameter is `null`, the overlay is
cleared
* `description` String - a description that will be provided to Accessibility
screen readers
Sets a 16px overlay onto the current Taskbar icon, usually used to convey some sort of application status or to passively notify the user.
Sets a 16px overlay onto the current taskbar icon, usually used to convey some sort of application status or to passively notify the user.
__Note:__ This API is only available on Windows, Win7 or above
__Note:__ This API is only available on Windows (Windows 7 and above)
### BrowserWindow.showDefinitionForSelection()
Shows pop-up dictionary that searches the selected word on the page.
__Note__: This API is available only on OS X.
__Note__: This API is only available on OS X.
### BrowserWindow.setAutoHideMenuBar(hide)
@ -753,7 +753,7 @@ Calling `event.preventDefault()` can prevent creating new windows.
Emitted when user or the page wants to start an navigation, it can happen when
`window.location` object is changed or user clicks a link in the page.
This event will not emit when the navigation is started programmely with APIs
This event will not emit when the navigation is started programmatically with APIs
like `WebContents.loadUrl` and `WebContents.back`.
Calling `event.preventDefault()` can prevent the navigation.

View file

@ -1,6 +1,6 @@
# Supported Chrome command line switches
Following command lines switches in Chrome browser are also Supported in
The following command lines switches in Chrome browser are also supported in
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:
@ -11,9 +11,14 @@ app.commandLine.appendSwitch('remote-debugging-port', '8315');
app.commandLine.appendSwitch('host-rules', 'MAP * 127.0.0.1');
app.on('ready', function() {
// Your code here
});
```
## --client-certificate=`path`
Sets `path` of client certificate file.
## --disable-http-cache
Disables the disk cache for HTTP requests.

View file

@ -36,8 +36,8 @@ selected, an example is:
filters: [
{ name: 'Images', extensions: ['jpg', 'png', 'gif'] },
{ name: 'Movies', extensions: ['mkv', 'avi', 'mp4'] },
{ name: 'Custom File Type', extensions: ['as'] },
],
{ name: 'Custom File Type', extensions: ['as'] }
]
}
```

View file

@ -28,7 +28,7 @@ var win = new BrowserWindow({ transparent: true, frame: false });
API to set window shape to solve this, but currently blocked at an
[upstream bug](https://code.google.com/p/chromium/issues/detail?id=387234).
* Transparent window is not resizable, setting `resizable` to `true` may make
transprent window stop working on some platforms.
transparent window stop working on some platforms.
* The `blur` filter only applies to the web page, so there is no way to apply
blur effect to the content below the window.
* On Windows transparent window will not work when DWM is disabled.

View file

@ -9,8 +9,10 @@ var globalShortcut = require('global-shortcut');
// Register a 'ctrl+x' shortcut listener.
var ret = globalShortcut.register('ctrl+x', function() { console.log('ctrl+x is pressed'); })
if (!ret)
console.log('registerion fails');
if (!ret) {
console.log('registration failed');
}
// Check whether a shortcut is registered.
console.log(globalShortcut.isRegistered('ctrl+x'));

View file

@ -29,8 +29,11 @@ window.addEventListener('contextmenu', function (e) {
Another example of creating the application menu with the simple template API:
```javascript
// main.js
```html
<!-- index.html -->
<script>
var remote = require('remote');
var Menu = remote.require('menu');
var template = [
{
label: 'Electron',
@ -69,7 +72,7 @@ var template = [
{
label: 'Quit',
accelerator: 'Command+Q',
click: function() { app.quit(); }
selector: 'terminate:'
},
]
},
@ -108,7 +111,7 @@ var template = [
label: 'Select All',
accelerator: 'Command+A',
selector: 'selectAll:'
},
}
]
},
{
@ -117,12 +120,12 @@ var template = [
{
label: 'Reload',
accelerator: 'Command+R',
click: function() { BrowserWindow.getFocusedWindow().reloadIgnoringCache(); }
click: function() { remote.getCurrentWindow().reload(); }
},
{
label: 'Toggle DevTools',
accelerator: 'Alt+Command+I',
click: function() { BrowserWindow.getFocusedWindow().toggleDevTools(); }
click: function() { remote.getCurrentWindow().toggleDevTools(); }
},
]
},
@ -145,18 +148,19 @@ var template = [
{
label: 'Bring All to Front',
selector: 'arrangeInFront:'
},
}
]
},
{
label: 'Help',
submenu: []
},
}
];
menu = Menu.buildFromTemplate(template);
Menu.setApplicationMenu(menu); // Must be called within app.on('ready', function(){ ... });
Menu.setApplicationMenu(menu);
</script>
```
## Class: Menu
@ -281,10 +285,10 @@ Template:
```javascript
[
{label: '4', id: '4'}
{label: '5', id: '5'}
{label: '1', id: '1', position: 'before=4'}
{label: '2', id: '2'}
{label: '4', id: '4'},
{label: '5', id: '5'},
{label: '1', id: '1', position: 'before=4'},
{label: '2', id: '2'},
{label: '3', id: '3'}
]
```
@ -303,11 +307,11 @@ Template:
```javascript
[
{label: 'a', position: 'endof=letters'}
{label: '1', position: 'endof=numbers'}
{label: 'b', position: 'endof=letters'}
{label: '2', position: 'endof=numbers'}
{label: 'c', position: 'endof=letters'}
{label: 'a', position: 'endof=letters'},
{label: '1', position: 'endof=numbers'},
{label: 'b', position: 'endof=letters'},
{label: '2', position: 'endof=numbers'},
{label: 'c', position: 'endof=letters'},
{label: '3', position: 'endof=numbers'}
]
```

View file

@ -7,8 +7,8 @@ An example of implementing a protocol that has the same effect with the
`file://` protocol:
```javascript
var app = require('app'),
path = require('path');
var app = require('app');
var path = require('path');
app.on('ready', function() {
var protocol = require('protocol');

View file

@ -15,7 +15,7 @@ app.on('ready', function(){
{ label: 'Item1', type: 'radio' },
{ label: 'Item2', type: 'radio' },
{ label: 'Item3', type: 'radio', checked: true },
{ label: 'Item4', type: 'radio' },
{ label: 'Item4', type: 'radio' }
]);
appIcon.setToolTip('This is my application.');
appIcon.setContextMenu(contextMenu);

View file

@ -18,7 +18,7 @@ form, the `webview` tag includes the `src` of the web page and css styles that
control the appearance of the `webview` container:
```html
<webview id="foo" src="https://www.github.com/" style="width:640px; height:480px"></webview>
<webview id="foo" src="https://www.github.com/" style="display:inline-block; width:640px; height:480px"></webview>
```
If you want to control the guest content in any way, you can write JavaScript
@ -398,7 +398,7 @@ without regard for log level or other properties.
```javascript
webview.addEventListener('console-message', function(e) {
console.log('Guest page logged a message: ', e.message);
console.log('Guest page logged a message:', e.message);
});
```
@ -456,7 +456,7 @@ webview.send('ping');
var ipc = require('ipc');
ipc.on('ping', function() {
ipc.sendToHost('pong');
})
});
```
### crashed