First translation
Translate docs to korean
This commit is contained in:
parent
a1cbd11b5b
commit
30dfd54575
18 changed files with 1849 additions and 0 deletions
46
docs/api/accelerator-ko.md
Normal file
46
docs/api/accelerator-ko.md
Normal file
|
@ -0,0 +1,46 @@
|
|||
# Accelerator
|
||||
|
||||
Accelerator는 키보드 단축키를 표현하는 문자열입니다, 여러 혼합키와 키코드를 `+` 문자를
|
||||
이용하여 결합할 수 있습니다.
|
||||
|
||||
예제:
|
||||
|
||||
* `Command+A`
|
||||
* `Ctrl+Shift+Z`
|
||||
|
||||
## 플랫폼에 관련하여 주의할 점
|
||||
|
||||
Linux와 Windows에서는 `Command`키가 없으므로 작동하지 않습니다. 대신에 `CommandOrControl`을
|
||||
사용하면 OS X의 `Command`와 Linux, Windows의 `Control` 모두 지원할 수 있습니다.
|
||||
|
||||
`Super`키는 Windows와 Linux 에서는 `윈도우`키를, OS X에서는 `Cmd`키로 맵핑됩니다.
|
||||
|
||||
## 사용 가능한 혼합키
|
||||
|
||||
* `Command` (단축어 `Cmd`)
|
||||
* `Control` (단축어 `Ctrl`)
|
||||
* `CommandOrControl` (단축어 `CmdOrCtrl`)
|
||||
* `Alt`
|
||||
* `Shift`
|
||||
* `Super`
|
||||
|
||||
## 사용 가능한 전체 키코드
|
||||
|
||||
* `0` 부터 `9` 까지
|
||||
* `A` 부터 `Z` 까지
|
||||
* `F1` 부터 `F24` 까지
|
||||
* `~`, `!`, `@`, `#`, `$`, etc 와 같은 구두점 기호들
|
||||
* `Plus`
|
||||
* `Space`
|
||||
* `Backspace`
|
||||
* `Delete`
|
||||
* `Insert`
|
||||
* `Return` (또는 `Enter`)
|
||||
* `Up`, `Down`, `Left` 와 `Right`
|
||||
* `Home` 그리고 `End`
|
||||
* `PageUp` 그리고 `PageDown`
|
||||
* `Escape` (단축어 `Esc`)
|
||||
* `VolumeUp`, `VolumeDown` 그리고 `VolumeMute`
|
||||
* `MediaNextTrack`, `MediaPreviousTrack`, `MediaStop` 그리고 `MediaPlayPause`
|
||||
|
||||
__키코드는 `단축어`로도 사용할 수 있습니다__
|
20
docs/api/menu-item-ko.md
Normal file
20
docs/api/menu-item-ko.md
Normal file
|
@ -0,0 +1,20 @@
|
|||
# menu-item
|
||||
|
||||
## Class: MenuItem
|
||||
|
||||
### new MenuItem(options)
|
||||
|
||||
* `options` Object
|
||||
* `click` Function - 메뉴 아이템이 클릭될 때 호출되는 콜백함수
|
||||
* `selector` String - First Responder가 클릭될 때 호출 되는 선택자 (OS X 전용)
|
||||
* `type` String - `MenuItem`의 타입 `normal`, `separator`, `submenu`, `checkbox` 또는 `radio` 사용가능
|
||||
* `label` String
|
||||
* `sublabel` String
|
||||
* `accelerator` [Accelerator](accelerator.md)
|
||||
* `icon` [NativeImage](native-image.md)
|
||||
* `enabled` Boolean
|
||||
* `visible` Boolean
|
||||
* `checked` Boolean
|
||||
* `submenu` Menu - 보조메뉴를 설정합니다. `type`이 `submenu`일 경우 반드시 설정해야합니다. 일반 메뉴 아이템일 경우 생략할 수 있습니다.
|
||||
* `id` String - 현재 메뉴 아이템에 대해 유일키를 지정합니다. 이 키는 이후 `position` 옵션에서 사용할 수 있습니다.
|
||||
* `position` String - 미리 지정한 `id`를 이용하여 메뉴 아이템의 위치를 세밀하게 조정합니다.
|
33
docs/api/power-monitor-ko.md
Normal file
33
docs/api/power-monitor-ko.md
Normal file
|
@ -0,0 +1,33 @@
|
|||
# power-monitor
|
||||
|
||||
`power-monitor` 모듈은 PC의 파워 상태를 나타냅니다. (주로 노트북 등에서 사용됩니다)
|
||||
이 모듈은 메인 프로세스에서만 사용할 수 있으며, (remote 모듈(RPC)을 사용해도 작동이 됩니다)
|
||||
메인 프로세스의 `app` 모듈에서 `ready` 이벤트를 호출하기 전까지 사용할 수 없습니다.
|
||||
|
||||
예제:
|
||||
|
||||
```javascript
|
||||
var app = require('app');
|
||||
|
||||
app.on('ready', function() {
|
||||
require('power-monitor').on('suspend', function() {
|
||||
console.log('절전모드로 진입합니다!');
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
## Event: suspend
|
||||
|
||||
시스템이 절전모드로 진입할 때 호출됩니다.
|
||||
|
||||
## Event: resume
|
||||
|
||||
시스템의 절전모드가 해제될 때 호출됩니다.
|
||||
|
||||
## Event: on-ac
|
||||
|
||||
시스템이 AC 어뎁터 충전기를 사용하기 시작할 때 호출됩니다.
|
||||
|
||||
## Event: on-battery
|
||||
|
||||
시스템이 배터리를 사용하기 시작할 때 호출됩니다.
|
139
docs/api/tray-ko.md
Normal file
139
docs/api/tray-ko.md
Normal file
|
@ -0,0 +1,139 @@
|
|||
# Tray
|
||||
|
||||
`Tray`는 OS의 알림영역에 아이콘을 표시합니다. 보통 컨텍스트 메뉴(context menu)를 같이 사용합니다.
|
||||
|
||||
```javascript
|
||||
var app = require('app');
|
||||
var Menu = require('menu');
|
||||
var Tray = require('tray');
|
||||
|
||||
var appIcon = null;
|
||||
app.on('ready', function(){
|
||||
appIcon = new Tray('/path/to/my/icon'); // 현재 어플리케이션 디렉터리를 기준으로 하려면 `__dirname + '/images/tray.png'` 형식으로 입력해야합니다.
|
||||
var contextMenu = Menu.buildFromTemplate([
|
||||
{ label: 'Item1', type: 'radio' },
|
||||
{ label: 'Item2', type: 'radio' },
|
||||
{ label: 'Item3', type: 'radio', checked: true },
|
||||
{ label: 'Item4', type: 'radio' }
|
||||
]);
|
||||
appIcon.setToolTip('이것은 나의 어플리케이션 입니다!');
|
||||
appIcon.setContextMenu(contextMenu);
|
||||
});
|
||||
|
||||
```
|
||||
|
||||
__플랫폼별 한계:__
|
||||
|
||||
* OS X에서는 트레이 아이콘이 컨텍스트 메뉴를 가지고 있을 경우 `clicked` 이벤트는 무시됩니다.
|
||||
* Linux에서는 앱 알림 표시기(app indicator)가 지원되면 해당 기능을 사용합니다. 만약 지원하지 않으면 `GtkStatusIcon`을 대신 사용합니다.
|
||||
* 앱 알림 표시기는 컨텍스트 메뉴를 가지고 있을 때만 보입니다.
|
||||
* Linux에서 앱 알림 표시기가 사용될 경우, `clicked` 이벤트는 무시됩니다.
|
||||
|
||||
이러한 이유로 만약 Tray API가 모든 플랫폼에서 똑같이 작동하게 하고 싶다면, 설계시 `clicked` 이벤트에 의존하지 말아야합니다.
|
||||
그리고 언제나 컨텍스트 메뉴를 포함해서 사용해야 합니다.
|
||||
|
||||
## Class: Tray
|
||||
|
||||
`Tray`는 [EventEmitter][event-emitter]를 상속 받았습니다.
|
||||
|
||||
### new Tray(image)
|
||||
|
||||
* `image` [NativeImage](native-image-ko.md)
|
||||
|
||||
전달된 `image`를 이용하여 트레이 아이콘을 만듭니다.
|
||||
|
||||
### Event: 'clicked'
|
||||
|
||||
* `event`
|
||||
* `bounds` Object - 트레이 아이콘의 범위
|
||||
* `x` Integer
|
||||
* `y` Integer
|
||||
* `width` Integer
|
||||
* `height` Integer
|
||||
|
||||
트레이 아이콘이 클릭될 때 호출됩니다.
|
||||
|
||||
__주의:__ `bounds`는 OS X와 Window 7 이후 버전에서만 작동합니다.
|
||||
|
||||
### Event: 'double-clicked'
|
||||
|
||||
트레이 아이콘이 더블 클릭될 때 호출됩니다.
|
||||
|
||||
__주의:__ 이 기능은 OS X에서만 작동합니다.
|
||||
|
||||
### Event: 'balloon-show'
|
||||
|
||||
알림풍선이 보여질 때 호출됩니다.
|
||||
|
||||
__주의:__ 이 기능은 Windows에서만 작동합니다.
|
||||
|
||||
### Event: 'balloon-clicked'
|
||||
|
||||
알림풍선이 클릭될 때 호출됩니다.
|
||||
|
||||
__주의:__ 이 기능은 Windows에서만 작동합니다.
|
||||
|
||||
### Event: 'balloon-closed'
|
||||
|
||||
알림풍선이 시간이 지나 사라지거나 유저가 클릭하여 닫을 때 호출됩니다.
|
||||
|
||||
__주의:__ 이 기능은 Windows에서만 작동합니다.
|
||||
|
||||
### Tray.destroy()
|
||||
|
||||
트레이 아이콘을 즉시 삭제시킵니다.
|
||||
|
||||
### Tray.setImage(image)
|
||||
|
||||
* `image` [NativeImage](native-image-ko.md)
|
||||
|
||||
`image`를 사용하여 트레이 아이콘의 이미지를 설정합니다.
|
||||
|
||||
### Tray.setPressedImage(image)
|
||||
|
||||
* `image` [NativeImage](native-image-ko.md)
|
||||
|
||||
`image`를 사용하여 트레이 아이콘이 눌렸을 때의 이미지를 설정합니다.
|
||||
|
||||
__주의:__ 이 기능은 OS X에서만 작동합니다.
|
||||
|
||||
### Tray.setToolTip(toolTip)
|
||||
|
||||
* `toolTip` String
|
||||
|
||||
트레이 아이콘의 툴팁 텍스트를 설정합니다.
|
||||
|
||||
### Tray.setTitle(title)
|
||||
|
||||
* `title` String
|
||||
|
||||
상태바에서 트레이 아이콘 옆에 표시되는 제목 텍스트를 설정합니다.
|
||||
|
||||
__주의:__ 이 기능은 OS X에서만 작동합니다.
|
||||
|
||||
### Tray.setHighlightMode(highlight)
|
||||
|
||||
* `highlight` Boolean
|
||||
|
||||
트레이 아이콘을 클릭했을 때 하이라이트 될지 설정합니다.
|
||||
|
||||
__주의:__ 이 기능은 OS X에서만 작동합니다.
|
||||
|
||||
### Tray.displayBalloon(options)
|
||||
|
||||
* `options` Object
|
||||
* `icon` [NativeImage](native-image-ko.md)
|
||||
* `title` String
|
||||
* `content` String
|
||||
|
||||
트레이에 알림풍선을 생성합니다.
|
||||
|
||||
__알림:__ 이 기능은 Windows에서만 작동합니다.
|
||||
|
||||
### Tray.setContextMenu(menu)
|
||||
|
||||
* `menu` Menu
|
||||
|
||||
트레이에 컨텍스트 메뉴를 설정합니다.
|
||||
|
||||
[event-emitter]: http://nodejs.org/api/events.html#events_class_events_eventemitter
|
479
docs/api/web-view-tag-ko.md
Normal file
479
docs/api/web-view-tag-ko.md
Normal file
|
@ -0,0 +1,479 @@
|
|||
# `<webview>` 태그
|
||||
|
||||
Use the `webview` tag to embed 'guest' content (such as web pages) in your
|
||||
Electron app. The guest content is contained within the `webview` container;
|
||||
an embedder page within your app controls how the guest content is laid out and
|
||||
rendered.
|
||||
|
||||
Different from the `iframe`, the `webview` runs in a separate process than your
|
||||
app; it doesn't have the same permissions as your web page and all interactions
|
||||
between your app and embedded content will be asynchronous. This keeps your app
|
||||
safe from the embedded content.
|
||||
|
||||
## 예제
|
||||
|
||||
To embed a web page in your app, add the `webview` tag to your app's embedder
|
||||
page (this is the app page that will display the guest content). In its simplest
|
||||
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="display:inline-block; width:640px; height:480px"></webview>
|
||||
```
|
||||
|
||||
If you want to control the guest content in any way, you can write JavaScript
|
||||
that listens for `webview` events and responds to those events using the
|
||||
`webview` methods. Here's sample code with two event listeners: one that listens
|
||||
for the web page to start loading, the other for the web page to stop loading,
|
||||
and displays a "loading..." message during the load time:
|
||||
|
||||
```html
|
||||
<script>
|
||||
onload = function() {
|
||||
var webview = document.getElementById("foo");
|
||||
var indicator = document.querySelector(".indicator");
|
||||
|
||||
var loadstart = function() {
|
||||
indicator.innerText = "loading...";
|
||||
}
|
||||
var loadstop = function() {
|
||||
indicator.innerText = "";
|
||||
}
|
||||
webview.addEventListener("did-start-loading", loadstart);
|
||||
webview.addEventListener("did-stop-loading", loadstop);
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
## 태그 속성
|
||||
|
||||
### src
|
||||
|
||||
```html
|
||||
<webview src="https://www.github.com/"></webview>
|
||||
```
|
||||
|
||||
Returns the visible URL. Writing to this attribute initiates top-level
|
||||
navigation.
|
||||
|
||||
Assigning `src` its own value will reload the current page.
|
||||
|
||||
The `src` attribute can also accept data URLs, such as
|
||||
`data:text/plain,Hello, world!`.
|
||||
|
||||
### autosize
|
||||
|
||||
```html
|
||||
<webview src="https://www.github.com/" autosize="on" minwidth="576" minheight="432"></webview>
|
||||
```
|
||||
|
||||
If "on", the `webview` container will automatically resize within the
|
||||
bounds specified by the attributes `minwidth`, `minheight`, `maxwidth`, and
|
||||
`maxheight`. These contraints do not impact the `webview` UNLESS `autosize` is
|
||||
enabled. When `autosize` is enabled, the `webview` container size cannot be less
|
||||
than the minimum values or greater than the maximum.
|
||||
|
||||
### nodeintegration
|
||||
|
||||
```html
|
||||
<webview src="http://www.google.com/" nodeintegration></webview>
|
||||
```
|
||||
|
||||
If "on", the guest page in `webview` will have node integration and can use node
|
||||
APIs like `require` and `process` to access low level system resources.
|
||||
|
||||
### plugins
|
||||
|
||||
```html
|
||||
<webview src="https://www.github.com/" plugins></webview>
|
||||
```
|
||||
|
||||
If "on", the guest page in `webview` will be able to use browser plugins.
|
||||
|
||||
### preload
|
||||
|
||||
```html
|
||||
<webview src="https://www.github.com/" preload="./test.js"></webview>
|
||||
```
|
||||
|
||||
Specifies a script that will be loaded before other scripts run in the guest
|
||||
page. The protocol of script's URL must be either `file:` or `asar:`, because it
|
||||
will be loaded by `require` in guest page under the hood.
|
||||
|
||||
When the guest page doesn't have node integration this script will still have
|
||||
access to all Node APIs, but global objects injected by Node will be deleted
|
||||
after this script has done execution.
|
||||
|
||||
### httpreferrer
|
||||
|
||||
```html
|
||||
<webview src="https://www.github.com/" httpreferrer="http://cheng.guru"></webview>
|
||||
```
|
||||
|
||||
Sets the referrer URL for the guest page.
|
||||
|
||||
### useragent
|
||||
|
||||
```html
|
||||
<webview src="https://www.github.com/" useragent="Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; AS; rv:11.0) like Gecko"></webview>
|
||||
```
|
||||
|
||||
Sets the user agent for the guest page before the page is navigated to. Once the page is loaded, use the `setUserAgent` method to change the user agent.
|
||||
|
||||
### disablewebsecurity
|
||||
|
||||
```html
|
||||
<webview src="https://www.github.com/" disablewebsecurity></webview>
|
||||
```
|
||||
|
||||
If "on", the guest page will have web security disabled.
|
||||
|
||||
## API
|
||||
|
||||
The webview element must be loaded before using the methods.
|
||||
**Example**
|
||||
```javascript
|
||||
webview.addEventListener("dom-ready", function(){
|
||||
webview.openDevTools();
|
||||
});
|
||||
```
|
||||
|
||||
### `<webview>`.getUrl()
|
||||
|
||||
Returns URL of guest page.
|
||||
|
||||
### `<webview>`.getTitle()
|
||||
|
||||
Returns the title of guest page.
|
||||
|
||||
### `<webview>`.isLoading()
|
||||
|
||||
Returns whether guest page is still loading resources.
|
||||
|
||||
### `<webview>`.isWaitingForResponse()
|
||||
|
||||
Returns whether guest page is waiting for a first-response for the main resource
|
||||
of the page.
|
||||
|
||||
### `<webview>`.stop()
|
||||
|
||||
Stops any pending navigation.
|
||||
|
||||
### `<webview>`.reload()
|
||||
|
||||
Reloads guest page.
|
||||
|
||||
### `<webview>`.reloadIgnoringCache()
|
||||
|
||||
Reloads guest page and ignores cache.
|
||||
|
||||
### `<webview>`.canGoBack()
|
||||
|
||||
Returns whether guest page can go back.
|
||||
|
||||
### `<webview>`.canGoForward()
|
||||
|
||||
Returns whether guest page can go forward.
|
||||
|
||||
### `<webview>`.canGoToOffset(offset)
|
||||
|
||||
* `offset` Integer
|
||||
|
||||
Returns whether guest page can go to `offset`.
|
||||
|
||||
### `<webview>`.clearHistory()
|
||||
|
||||
Clears the navigation history.
|
||||
|
||||
### `<webview>`.goBack()
|
||||
|
||||
Makes guest page go back.
|
||||
|
||||
### `<webview>`.goForward()
|
||||
|
||||
Makes guest page go forward.
|
||||
|
||||
### `<webview>`.goToIndex(index)
|
||||
|
||||
* `index` Integer
|
||||
|
||||
Navigates to the specified absolute index.
|
||||
|
||||
### `<webview>`.goToOffset(offset)
|
||||
|
||||
* `offset` Integer
|
||||
|
||||
Navigates to the specified offset from the "current entry".
|
||||
|
||||
### `<webview>`.isCrashed()
|
||||
|
||||
Whether the renderer process has crashed.
|
||||
|
||||
### `<webview>`.setUserAgent(userAgent)
|
||||
|
||||
* `userAgent` String
|
||||
|
||||
Overrides the user agent for guest page.
|
||||
|
||||
### `<webview>`.insertCSS(css)
|
||||
|
||||
* `css` String
|
||||
|
||||
Injects CSS into guest page.
|
||||
|
||||
### `<webview>`.executeJavaScript(code)
|
||||
|
||||
* `code` String
|
||||
|
||||
Evaluates `code` in guest page.
|
||||
|
||||
### `<webview>`.openDevTools()
|
||||
|
||||
Opens a devtools window for guest page.
|
||||
|
||||
### `<webview>`.closeDevTools()
|
||||
|
||||
Closes the devtools window of guest page.
|
||||
|
||||
### `<webview>`.isDevToolsOpened()
|
||||
|
||||
Returns whether guest page has a devtools window attached.
|
||||
|
||||
### `<webview>`.inspectElement(x, y)
|
||||
|
||||
* `x` Integer
|
||||
* `y` Integer
|
||||
|
||||
Starts inspecting element at position (`x`, `y`) of guest page.
|
||||
|
||||
### `<webview>`.inspectServiceWorker()
|
||||
|
||||
Opens the devtools for the service worker context present in the guest page.
|
||||
|
||||
### `<webview>`.undo()
|
||||
|
||||
Executes editing command `undo` in page.
|
||||
|
||||
### `<webview>`.redo()
|
||||
|
||||
Executes editing command `redo` in page.
|
||||
|
||||
### `<webview>`.cut()
|
||||
|
||||
Executes editing command `cut` in page.
|
||||
|
||||
### `<webview>`.copy()
|
||||
|
||||
Executes editing command `copy` in page.
|
||||
|
||||
### `<webview>`.paste()
|
||||
|
||||
Executes editing command `paste` in page.
|
||||
|
||||
### `<webview>`.pasteAndMatchStyle()
|
||||
|
||||
Executes editing command `pasteAndMatchStyle` in page.
|
||||
|
||||
### `<webview>`.delete()
|
||||
|
||||
Executes editing command `delete` in page.
|
||||
|
||||
### `<webview>`.selectAll()
|
||||
|
||||
Executes editing command `selectAll` in page.
|
||||
|
||||
### `<webview>`.unselect()
|
||||
|
||||
Executes editing command `unselect` in page.
|
||||
|
||||
### `<webview>`.replace(text)
|
||||
|
||||
* `text` String
|
||||
|
||||
Executes editing command `replace` in page.
|
||||
|
||||
### `<webview>`.replaceMisspelling(text)
|
||||
|
||||
* `text` String
|
||||
|
||||
Executes editing command `replaceMisspelling` in page.
|
||||
|
||||
### `<webview>`.send(channel[, args...])
|
||||
|
||||
* `channel` String
|
||||
|
||||
Send `args..` to guest page via `channel` in asynchronous message, the guest
|
||||
page can handle it by listening to the `channel` event of `ipc` module.
|
||||
|
||||
See [WebContents.send](browser-window-ko.md#webcontentssendchannel-args) for
|
||||
examples.
|
||||
|
||||
## DOM 이벤트
|
||||
|
||||
### did-finish-load
|
||||
|
||||
Fired when the navigation is done, i.e. the spinner of the tab will stop
|
||||
spinning, and the `onload` event was dispatched.
|
||||
|
||||
### did-fail-load
|
||||
|
||||
* `errorCode` Integer
|
||||
* `errorDescription` String
|
||||
|
||||
This event is like `did-finish-load`, but fired when the load failed or was
|
||||
cancelled, e.g. `window.stop()` is invoked.
|
||||
|
||||
### did-frame-finish-load
|
||||
|
||||
* `isMainFrame` Boolean
|
||||
|
||||
Fired when a frame has done navigation.
|
||||
|
||||
### did-start-loading
|
||||
|
||||
Corresponds to the points in time when the spinner of the tab starts spinning.
|
||||
|
||||
### did-stop-loading
|
||||
|
||||
Corresponds to the points in time when the spinner of the tab stops spinning.
|
||||
|
||||
### did-get-response-details
|
||||
|
||||
* `status` Boolean
|
||||
* `newUrl` String
|
||||
* `originalUrl` String
|
||||
* `httpResponseCode` Integer
|
||||
* `requestMethod` String
|
||||
* `referrer` String
|
||||
* `headers` Object
|
||||
|
||||
Fired when details regarding a requested resource is available.
|
||||
`status` indicates socket connection to download the resource.
|
||||
|
||||
### did-get-redirect-request
|
||||
|
||||
* `oldUrl` String
|
||||
* `newUrl` String
|
||||
* `isMainFrame` Boolean
|
||||
|
||||
Fired when a redirect was received while requesting a resource.
|
||||
|
||||
### dom-ready
|
||||
|
||||
Fired when document in the given frame is loaded.
|
||||
|
||||
### page-title-set
|
||||
|
||||
* `title` String
|
||||
* `explicitSet` Boolean
|
||||
|
||||
Fired when page title is set during navigation. `explicitSet` is false when title is synthesised from file
|
||||
url.
|
||||
|
||||
### page-favicon-updated
|
||||
|
||||
* `favicons` Array - Array of Urls
|
||||
|
||||
Fired when page receives favicon urls.
|
||||
|
||||
### enter-html-full-screen
|
||||
|
||||
Fired when page enters fullscreen triggered by html api.
|
||||
|
||||
### leave-html-full-screen
|
||||
|
||||
Fired when page leaves fullscreen triggered by html api.
|
||||
|
||||
### console-message
|
||||
|
||||
* `level` Integer
|
||||
* `message` String
|
||||
* `line` Integer
|
||||
* `sourceId` String
|
||||
|
||||
Fired when the guest window logs a console message.
|
||||
|
||||
The following example code forwards all log messages to the embedder's console
|
||||
without regard for log level or other properties.
|
||||
|
||||
```javascript
|
||||
webview.addEventListener('console-message', function(e) {
|
||||
console.log('Guest page logged a message:', e.message);
|
||||
});
|
||||
```
|
||||
|
||||
### new-window
|
||||
|
||||
* `url` String
|
||||
* `frameName` String
|
||||
* `disposition` String - Can be `default`, `foreground-tab`, `background-tab`,
|
||||
`new-window` and `other`
|
||||
|
||||
Fired when the guest page attempts to open a new browser window.
|
||||
|
||||
The following example code opens the new url in system's default browser.
|
||||
|
||||
```javascript
|
||||
webview.addEventListener('new-window', function(e) {
|
||||
require('shell').openExternal(e.url);
|
||||
});
|
||||
```
|
||||
|
||||
### close
|
||||
|
||||
Fired when the guest page attempts to close itself.
|
||||
|
||||
The following example code navigates the `webview` to `about:blank` when the
|
||||
guest attempts to close itself.
|
||||
|
||||
```javascript
|
||||
webview.addEventListener('close', function() {
|
||||
webview.src = 'about:blank';
|
||||
});
|
||||
```
|
||||
|
||||
### ipc-message
|
||||
|
||||
* `channel` String
|
||||
* `args` Array
|
||||
|
||||
Fired when the guest page has sent an asynchronous message to embedder page.
|
||||
|
||||
With `sendToHost` method and `ipc-message` event you can easily communicate
|
||||
between guest page and embedder page:
|
||||
|
||||
```javascript
|
||||
// In embedder page.
|
||||
webview.addEventListener('ipc-message', function(event) {
|
||||
console.log(event.channel);
|
||||
// Prints "pong"
|
||||
});
|
||||
webview.send('ping');
|
||||
```
|
||||
|
||||
```javascript
|
||||
// In guest page.
|
||||
var ipc = require('ipc');
|
||||
ipc.on('ping', function() {
|
||||
ipc.sendToHost('pong');
|
||||
});
|
||||
```
|
||||
|
||||
### crashed
|
||||
|
||||
Fired when the renderer process is crashed.
|
||||
|
||||
### gpu-crashed
|
||||
|
||||
Fired when the gpu process is crashed.
|
||||
|
||||
### plugin-crashed
|
||||
|
||||
* `name` String
|
||||
* `version` String
|
||||
|
||||
Fired when a plugin process is crashed.
|
||||
|
||||
### destroyed
|
||||
|
||||
Fired when the WebContents is destroyed.
|
Loading…
Add table
Add a link
Reference in a new issue