Fix charsets, add more translated files

This commit is contained in:
Plusb Preco 2015-06-29 21:41:11 +09:00
parent ebb031dafe
commit fcf4da1097
7 changed files with 229 additions and 49 deletions

View file

@ -101,6 +101,34 @@ Emitted when a [browserWindow](browser-window.md) gets blurred.
Emitted when a [browserWindow](browser-window.md) gets focused.
### Event: 'select-certificate'
Emitted when client certificate is requested.
* `event` Event
* `webContents` [WebContents](browser-window.md#class-webcontents)
* `url` String
* `certificateList` [Objects]
* `data` PEM encoded data
* `issuerName` Issuer's Common Name
* `callback` Function
```
app.on('select-certificate', function(event, host, url, list, callback) {
event.preventDefault();
callback(list[0]);
})
```
`url` corresponds to the navigation entry requesting the client certificate,
`callback` needs to be called with an entry filtered from the list.
`event.preventDefault()` prevents from using the first certificate from
the store.
### Event: 'gpu-process-crashed'
Emitted when the gpu process is crashed.
## app.quit()
Try to close all windows. The `before-quit` event will first be emitted. If all

View file

@ -219,6 +219,21 @@ Emitted when devtools is closed.
Emitted when devtools is focused / opened.
### Event: 'app-command':
Emitted when an [App Command](https://msdn.microsoft.com/en-us/library/windows/desktop/ms646275(v=vs.85).aspx) is invoked. These are typically related to keyboard media keys or browser commands, as well as the "Back" button built into some mice on Windows.
```js
someWindow.on('app-command', function(e, cmd) {
// Navigate the window back when the user hits their mouse back button
if (cmd === 'browser-backward' && someWindow.webContents.canGoBack()) {
someWindow.webContents.goBack();
}
});
```
__Note__: This event is only fired on Windows.
### Class Method: BrowserWindow.getAllWindows()
Returns an array of all opened browser windows.
@ -517,6 +532,10 @@ Opens the developer tools.
Closes the developer tools.
### BrowserWindow.isDevToolsOpened()
Returns whether the developer tools are opened.
### BrowserWindow.toggleDevTools()
Toggle the developer tools.
@ -753,10 +772,6 @@ Calling `event.preventDefault()` can prevent the navigation.
Emitted when the renderer process is crashed.
### Event: 'gpu-crashed'
Emitted when the gpu process is crashed.
### Event: 'plugin-crashed'
* `event` Event
@ -976,10 +991,29 @@ size.
Prints windows' web page as PDF with Chromium's preview printing custom
settings.
By default, the options will be
By default, an empty `options` will be regarded as
`{marginsType:0, printBackgrounds:false, printSelectionOnly:false,
landscape:false}`.
```javascript
var BrowserWindow = require('browser-window');
var fs = require('fs');
var win = new BrowserWindow({width: 800, height: 600});
win.loadUrl("http://github.com");
win.webContents.on("did-finish-load", function() {
// Use default printing options
win.webContents.printToPDF({}, function(error, data) {
if (error) throw error;
fs.writeFile(dist, data, function(error) {
if (err)
alert('write pdf file error', error);
})
})
});
```
### WebContents.send(channel[, args...])
* `channel` String
@ -1020,3 +1054,90 @@ app.on('ready', function() {
is different from the handlers on the main process.
2. There is no way to send synchronous messages from the main process to a
renderer process, because it would be very easy to cause dead locks.
## Class: WebContents.session.cookies
The `cookies` gives you ability to query and modify cookies, an example is:
```javascipt
var BrowserWindow = require('browser-window');
var win = new BrowserWindow({ width: 800, height: 600 });
win.loadUrl('https://github.com');
win.webContents.on('did-finish-load', function() {
// Query all cookies.
win.webContents.session.cookies.get({}, function(error, cookies) {
if (error) throw error;
console.log(cookies);
});
// Query all cookies that are associated with a specific url.
win.webContents.session.cookies.get({ url : "http://www.github.com" },
function(error, cookies) {
if (error) throw error;
console.log(cookies);
});
// Set a cookie with the given cookie data;
// may overwrite equivalent cookies if they exist.
win.webContents.session.cookies.set(
{ url : "http://www.github.com", name : "dummy_name", value : "dummy"},
function(error, cookies) {
if (error) throw error;
console.log(cookies);
});
});
```
### WebContents.session.cookies.get(details, callback)
* `details` Object
* `url` String - Retrieves cookies which are associated with `url`.
Empty imples retrieving cookies of all urls.
* `name` String - Filters cookies by name
* `domain` String - Retrieves cookies whose domains match or are subdomains of `domains`
* `path` String - Retrieves cookies whose path matches `path`
* `secure` Boolean - Filters cookies by their Secure property
* `session` Boolean - Filters out session or persistent cookies.
* `callback` Function - function(error, cookies)
* `error` Error
* `cookies` Array - array of `cookie` objects.
* `cookie` - Object
* `name` String - The name of the cookie
* `value` String - The value of the cookie
* `domain` String - The domain of the cookie
* `host_only` String - Whether the cookie is a host-only cookie
* `path` String - The path of the cookie
* `secure` Boolean - Whether the cookie is marked as Secure (typically HTTPS)
* `http_only` Boolean - Whether the cookie is marked as HttpOnly
* `session` Boolean - Whether the cookie is a session cookie or a persistent
* cookie with an expiration date.
* `expirationDate` Double - (Option) The expiration date of the cookie as
the number of seconds since the UNIX epoch. Not provided for session cookies.
### WebContents.session.cookies.set(details, callback)
* `details` Object
* `url` String - Retrieves cookies which are associated with `url`
* `name` String - The name of the cookie. Empty by default if omitted.
* `value` String - The value of the cookie. Empty by default if omitted.
* `domain` String - The domain of the cookie. Empty by default if omitted.
* `path` String - The path of the cookie. Empty by default if omitted.
* `secure` Boolean - Whether the cookie should be marked as Secure. Defaults to false.
* `session` Boolean - Whether the cookie should be marked as HttpOnly. Defaults to false.
* `expirationDate` Double - The expiration date of the cookie as the number of
seconds since the UNIX epoch. If omitted, the cookie becomes a session cookie.
* `callback` Function - function(error)
* `error` Error
### WebContents.session.cookies.remove(details, callback)
* `details` Object
* `url` String - The URL associated with the cookie
* `name` String - The name of cookie to remove
* `callback` Function - function(error)
* `error` Error

View file

@ -1,17 +1,15 @@
# NativeImage
In Electron for the APIs that take images, you can pass either file paths or
`NativeImage` instances. When passing `null`, an empty image will be used.
Electron은 파일 경로나 `NativeImage` 인스턴스를 전달하여 사용하는 이미지 API를 가지고 있습니다. `null`을 전달할 경우 빈 이미지가 사용됩니다.
For example, when creating a tray or setting a window's icon, you can pass an image
file path as a `String`:
예를 들어 트레이 메뉴를 만들거나 윈도우의 아이콘을 설정할 때 다음과 같이 `문자열`인 파일 경로를 전달할 수 있습니다:
```javascript
var appIcon = new Tray('/Users/somebody/images/icon.png');
var window = new BrowserWindow({icon: '/Users/somebody/images/window.png'});
```
Or read the image from the clipboard:
또는 클립보드로부터 이미지를 읽어올 수 있습니다:
```javascript
var clipboard = require('clipboard');
@ -19,12 +17,11 @@ var image = clipboard.readImage();
var appIcon = new Tray(image);
```
## Supported formats
## 지원하는 포맷
Currently `PNG` and `JPEG` are supported. It is recommended to use `PNG`
because of its support for transparency and lossless compression.
현재 `PNG``JPEG` 포맷을 지원하고 있습니다. 손실 없는 이미지 압축과 투명도 지원을 위해 `PNG` 사용을 권장합니다.
## High resolution image
## 고해상도 이미지
On platforms that have high-DPI support, you can append `@2x` after image's
file name's base name to mark it as a high resolution image.

View file

@ -0,0 +1,48 @@
# power-save-blocker
The `power-save-blocker` module is used to block the system from entering
low-power(sleep) mode, allowing app to keep system and screen active.
An example is:
```javascript
var powerSaveBlocker = require('power-save-blocker');
var id = powerSaveBlocker.start('prevent-display-sleep');
console.log(powerSaveBlocker.isStarted(id));
powerSaveBlocker.stop(id);
```
## powerSaveBlocker.start(type)
* `type` String - Power save blocker type
* `prevent-app-suspension` - Prevent the application from being suspended.
Keeps system active, but allows screen to be turned off. Example use cases:
downloading a file, playing audio.
* `prevent-display-sleep`- Prevent the display from going to sleep. Keeps system
and screen active. Example use case: playing video.
Starts the power save blocker preventing the system entering lower-power mode.
Returns an integer identified the power save blocker.
**Note:**
`prevent-display-sleep` has higher precedence level than `prevent-app-suspension`.
Only the highest precedence type takes effect. In other words, `prevent-display-sleep`
always take precedence over `prevent-app-suspension`.
For example, an API calling A requests for `prevent-app-suspension`, and
another calling B requests for `prevent-display-sleep`. `prevent-display-sleep`
will be used until B stops its request. After that, `prevent-app-suspension` is used.
## powerSaveBlocker.stop(id)
* `id` Integer - The power save blocker id returned by `powerSaveBlocker.start`.
Stops the specified power save blocker.
## powerSaveBlocker.isStarted(id)
* `id` Integer - The power save blocker id returned by `powerSaveBlocker.start`.
Returns whether the corresponding `powerSaveBlocker` starts.