* [빌드 설명서 (Linux)](development/build-instructions-linux-ko.md)
* [디버거에서 디버그 심볼 서버 설정](development/setting-up-symbol-server-ko.md)
-이 문서는 [@preco21](https://github.com/preco21) 이 번역하였습니다.
+이 문서는 [@preco21](https://github.com/preco21) 에 의해 번역되었습니다.
+문서내에서 오타나 잘못된 번역이 발견될 경우 해당 repo를 fork한 후 수정하여 PR을 올리거나 `plusb21@gmail.com` 이메일로 알려주시면 감사하겠습니다.
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
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.
Closes the developer tools.
+### BrowserWindow.isDevToolsOpened()
+
+Returns whether the developer tools are opened.
+
### BrowserWindow.toggleDevTools()
Toggle the developer tools.
Emitted when the renderer process is crashed.
-### Event: 'gpu-crashed'
-
-Emitted when the gpu process is crashed.
-
### Event: 'plugin-crashed'
* `event` Event
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
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
# 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');
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.
--- /dev/null
+# 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.
* [Node.js](http://nodejs.org/download/)
* [git](http://git-scm.com)
-아직 Windows를 설치하지 않았다면 [modern.ie](https://www.modern.ie/en-us/virtualization-tools#downloads)에서 Electron을 빌드할 수 있는 timebombed Windows 버전을 확인할 수 있습니다.
-
-If you don't have a Windows installation at the moment,
-[modern.ie](https://www.modern.ie/en-us/virtualization-tools#downloads) has
-timebombed versions of Windows that you can use to build Electron.
+현재 Windows를 설치하지 않았다면 [modern.ie](https://www.modern.ie/en-us/virtualization-tools#downloads)에서
+사용기한이 정해져있는 무료 가상머신 버전의 Windows를 받아 Electron을 빌드할 수도 있습니다.
Electron은 전적으로 command-line 스크립트를 사용하여 빌드합니다. 그렇기에 Electron을 개발하는데 아무런 에디터나 사용할 수 있습니다.
하지만 이 말은 Visual Studio를 개발을 위해 사용할 수 없다는 말이 됩니다. 나중에 Visual Studio를 이용한 빌드 방법도 제공할 예정입니다.
-# 디버거에서 디버그 심볼 서버 설정
-
-Debug symbols allow you to have better debugging sessions. They have information
-about the functions contained in executables and dynamic libraries and provide
-you with information to get clean call stacks. A Symbol Server allows the
-debugger to load the correct symbols, binaries and sources automatically without
-forcing users to download large debugging files. The server functions like
-[Microsoft's symbol server](http://support.microsoft.com/kb/311503) so the
-documentation there can be useful.
-
-Note that because released Electron builds are heavily optimized, debugging is
-not always easy. The debugger will not be able to show you the content of all
-variables and the execution path can seem strange because of inlining, tail
-calls, and other compiler optimizations. The only workaround is to build an
-unoptimized local build.
-
-The official symbol server URL for Electron is
-http://54.249.141.255:8086/atom-shell/symbols.
-You cannot visit this URL directly: you must add it to the symbol path of your
-debugging tool. In the examples below, a local cache directory is used to avoid
-repeatedly fetching the PDB from the server. Replace `c:\code\symbols` with an
-appropriate cache directory on your machine.
+# 디버거에서 디버그 심볼 서버 설정
+
+디버그 심볼은 디버깅 세션을 더 좋게 개선해 줍니다. 디버그 심볼은 실행 파일과 동적 링크 라이브러리에서 함수에 대한 정보를 담고 있으며 명료한 함수 호출 스텍 정보를 제공합니다.
+심볼 서버는 유저가 크기가 큰 디버깅용 파일을 필수적으로 다운로드 받지 않고도 디버거가 알맞은 심볼, 바이너리 그리고 소스를 자동적으로 로드할 수 있도록 해줍니다.
+서버 사용법은 [Microsoft의 심볼 서버](http://support.microsoft.com/kb/311503)와 비슷합니다. 이 문서를 참조하세요.
+
+참고로 릴리즈된 Electron 빌드는 자체적으로 많은 최적화가 되어 있는 관계로 경우에 따라 디버깅이 쉽지 않을 수 있습니다.
+Inlining, tail call 등의 컴파일러 최적화에 의해 디버거가 모든 변수의 컨텐츠를 보여줄 수 없는 경우도 있고 실행 경로가 이상하게 보여질 수 있습니다.
+유일한 해결 방법은 최적화되지 않은 로컬 빌드를 하는 것입니다.
+
+공식적인 Electron의 심볼 서버의 URL은 http://54.249.141.255:8086/atom-shell/symbols 입니다.
+일단 이 URL에 직접적으로 접근할 수는 없습니다: 디버깅 툴에 심볼의 경로를 추가해야합니다.
+아래의 예제를 참고하면 로컬 캐시 디렉터리는 서버로부터 중복되지 않게 PDB를 가져오는데 사용됩니다.
+`c:\code\symbols` 캐시 디렉터리를 사용중인 OS에 맞춰 적당한 경로로 변경하세요.
## Windbg에서 심볼 서버 사용하기
-The Windbg symbol path is configured with a string value delimited with asterisk
-characters. To use only the Electron symbol server, add the following entry to
-your symbol path (__note:__ you can replace `c:\code\symbols` with any writable
-directory on your computer, if you'd prefer a different location for downloaded
-symbols):
+Windbg 심볼 경로는 구분자와 *(별) 문자로 설정되어 있습니다.
+Electron 심볼 서버만을 사용하려면 심볼 경로의 엔트리를 추가해야 합니다 (__참고:__ `c:\code\symbols` 디렉터리 경로를 PC가 원하는 경로로 수정할 수 있습니다):
```
SRV*c:\code\symbols\*http://54.249.141.255:8086/atom-shell/symbols
```
-Set this string as `_NT_SYMBOL_PATH` in the environment, using the Windbg menus,
-or by typing the `.sympath` command. If you would like to get symbols from
-Microsoft's symbol server as well, you should list that first:
+Windbg 메뉴 또는 `.sympath` 커맨드를 이용하여 환경에 `_NT_SYMBOL_PATH` 문자열을 설정합니다.
+만약 Microsoft의 심볼서버로 부터 심볼을 받아오려면 다음과 같이 리스팅을 먼저 해야합니다:
```
SRV*c:\code\symbols\*http://msdl.microsoft.com/download/symbols;SRV*c:\code\symbols\*http://54.249.141.255:8086/atom-shell/symbols
```
-## Using the symbol server in Visual Studio
+## Visual Studio에서 심볼 서버 사용하기
<img src='http://mdn.mozillademos.org/files/733/symbol-server-vc8express-menu.jpg'>
<img src='http://mdn.mozillademos.org/files/2497/2005_options.gif'>
## 문제 해결: Symbols will not load
-Type the following commands in Windbg to print why symbols are not loading:
+Windbg에서 다음의 커맨드를 입력하여 왜 심볼이 로드되지 않았는지에 대한 오류 내역을 출력합니다:
```
> !sym noisy