📝 use h3 headings for events and methods, per the styleguide

This commit is contained in:
Zeke Sikelianos 2016-06-17 12:16:15 -07:00
parent 40c195cf5c
commit 0d481aaeb8
8 changed files with 110 additions and 110 deletions

View file

@ -70,7 +70,7 @@ session.defaultSession.on('will-download', function(event, item, webContents) {
`Session`のインスタンス上で次のメソッドが提供されています:
#### `ses.cookies`
### `ses.cookies`
`cookies`は、cookiesに問い合わせしたり、修正をできるようにします。例
@ -94,7 +94,7 @@ session.defaultSession.cookies.set(cookie, function(error) {
});
```
#### `ses.cookies.get(filter, callback)`
### `ses.cookies.get(filter, callback)`
* `filter` Object
* `url` String (オプション) - `url`に関連付けられているcookiesを取得します。空の場合すべてのurlのcookiesを取得します
@ -122,7 +122,7 @@ session.defaultSession.cookies.set(cookie, function(error) {
cookieの有効期限をUNIX時間で何秒かを示します。セッションcookiesは提供されません。
#### `ses.cookies.set(details, callback)`
### `ses.cookies.set(details, callback)`
* `details` Object
* `url` String - `url`に関連付けられているcookiesを取得します。
@ -137,7 +137,7 @@ cookieの有効期限をUNIX時間で何秒かを示します。セッションc
`details`でcookieを設定し、完了すると`callback(error)`で`callback`がコールされます。
#### `ses.cookies.remove(url, name, callback)`
### `ses.cookies.remove(url, name, callback)`
* `url` String - cookieに関連付けられているURL
* `name` String - 削除するcookieの名前
@ -145,20 +145,20 @@ cookieの有効期限をUNIX時間で何秒かを示します。セッションc
`url``name`と一致するcookiesを削除し、完了すると`callback`が、`callback()`でコールされます。
#### `ses.getCacheSize(callback)`
### `ses.getCacheSize(callback)`
* `callback` Function
* `size` Integer - 使用しているキャッシュサイズバイト数
現在のセッションのキャッシュサイズを返します。
#### `ses.clearCache(callback)`
### `ses.clearCache(callback)`
* `callback` Function - 操作が完了したら、コールされます。
セッションのHTTPキャッシュをクリアします。
#### `ses.clearStorageData([options, ]callback)`
### `ses.clearStorageData([options, ]callback)`
* `options` Object (オプション)
* `origin` String - `window.location.origin`の説明で、`scheme://host:port`に従う
@ -171,11 +171,11 @@ cookieの有効期限をUNIX時間で何秒かを示します。セッションc
ウェブストレージのデータをクリアします。
#### `ses.flushStorageData()`
### `ses.flushStorageData()`
書き込まれていないDOMStorageデータをディスクに書き込みます。
#### `ses.setProxy(config, callback)`
### `ses.setProxy(config, callback)`
* `config` Object
* `pacScript` String - PACファイルに関連付けらえたURL
@ -213,13 +213,13 @@ proxyURL = [<proxyScheme>"://"]<proxyHost>[":"<proxyPort>]
`url`をプロキシ情報で解決します。リクエストが実行された時、`callback(proxy)`で `callback`がコールされます。
#### `ses.setDownloadPath(path)`
### `ses.setDownloadPath(path)`
* `path` String - ダウンロード場所
ダウンロードの保存ディレクトリを設定します。既定では、ダウンロードディレクトリは、個別のアプリフォルダー下の`Downloads`です。
#### `ses.enableNetworkEmulation(options)`
### `ses.enableNetworkEmulation(options)`
* `options` Object
* `offline` Boolean - ネットワーク停止を再現するかどうか
@ -241,11 +241,11 @@ window.webContents.session.enableNetworkEmulation({
window.webContents.session.enableNetworkEmulation({offline: true});
```
#### `ses.disableNetworkEmulation()`
### `ses.disableNetworkEmulation()`
`session`ですでに有効になっているネットワークエミュレーションを無効化します。オリジナルのネットワーク設定にリセットします。
#### `ses.setCertificateVerifyProc(proc)`
### `ses.setCertificateVerifyProc(proc)`
* `proc` Function
@ -262,7 +262,7 @@ myWindow.webContents.session.setCertificateVerifyProc(function(hostname, cert, c
});
```
#### `ses.webRequest`
### `ses.webRequest`
`webRequest`APIセットをインターセプトし、そのライフタイムの様々な段階でリクエストの内容を変更できます。
@ -284,7 +284,7 @@ session.defaultSession.webRequest.onBeforeSendHeaders(filter, function(details,
});
```
#### `ses.webRequest.onBeforeRequest([filter, ]listener)`
### `ses.webRequest.onBeforeRequest([filter, ]listener)`
* `filter` Object
* `listener` Function
@ -312,7 +312,7 @@ session.defaultSession.webRequest.onBeforeSendHeaders(filter, function(details,
* `cancel` Boolean (オプション)
* `redirectURL` String (オプション) - オリジナルリクエストが送信もしくは完了するのを中断し、代わりに付与したURLにリダイレクトします。
#### `ses.webRequest.onBeforeSendHeaders([filter, ]listener)`
### `ses.webRequest.onBeforeSendHeaders([filter, ]listener)`
* `filter` Object
* `listener` Function
@ -334,7 +334,7 @@ The `callback` has to be called with an `response` object:
* `cancel` Boolean (オプション)
* `requestHeaders` Object (オプション) - 付与されると、リクエストはそれらのヘッダーで作成されます。
#### `ses.webRequest.onSendHeaders([filter, ]listener)`
### `ses.webRequest.onSendHeaders([filter, ]listener)`
* `filter` Object
* `listener` Function
@ -349,7 +349,7 @@ The `callback` has to be called with an `response` object:
* `timestamp` Double
* `requestHeaders` Object
#### `ses.webRequest.onHeadersReceived([filter,] listener)`
### `ses.webRequest.onHeadersReceived([filter,] listener)`
* `filter` Object
* `listener` Function
@ -373,7 +373,7 @@ The `callback` has to be called with an `response` object:
* `cancel` Boolean
* `responseHeaders` Object (オプション) - 付与されていると、これらのヘッダーでサーバーはレスポンスしたと仮定します。
#### `ses.webRequest.onResponseStarted([filter, ]listener)`
### `ses.webRequest.onResponseStarted([filter, ]listener)`
* `filter` Object
* `listener` Function
@ -391,7 +391,7 @@ The `callback` has to be called with an `response` object:
* `statusCode` Integer
* `statusLine` String
#### `ses.webRequest.onBeforeRedirect([filter, ]listener)`
### `ses.webRequest.onBeforeRedirect([filter, ]listener)`
* `filter` Object
* `listener` Function
@ -410,7 +410,7 @@ The `callback` has to be called with an `response` object:
* `fromCache` Boolean
* `responseHeaders` Object
#### `ses.webRequest.onCompleted([filter, ]listener)`
### `ses.webRequest.onCompleted([filter, ]listener)`
* `filter` Object
* `listener` Function
@ -428,7 +428,7 @@ The `callback` has to be called with an `response` object:
* `statusCode` Integer
* `statusLine` String
#### `ses.webRequest.onErrorOccurred([filter, ]listener)`
### `ses.webRequest.onErrorOccurred([filter, ]listener)`
* `filter` Object
* `listener` Function

View file

@ -217,7 +217,7 @@ Menu.setApplicationMenu(menu);
새로운 메뉴를 생성합니다.
### Methods
## Methods
`menu` 클래스는 다음과 같은 메서드를 가지고 있습니다:

View file

@ -53,7 +53,7 @@ const ses = session.fromPartition('persist:name');
`Session` 객체는 다음과 같은 이벤트를 가지고 있습니다:
#### Event: 'will-download'
### Event: 'will-download'
* `event` Event
* `item` [DownloadItem](download-item.md)
@ -77,7 +77,7 @@ session.defaultSession.on('will-download', (event, item, webContents) => {
`Session` 객체는 다음과 같은 메서드와 속성을 가지고 있습니다:
#### `ses.cookies`
### `ses.cookies`
`cookies` 속성은 쿠키를 조작하는 방법을 제공합니다. 예를 들어 다음과 같이 할 수
있습니다:
@ -102,7 +102,7 @@ session.defaultSession.cookies.set(cookie, (error) => {
});
```
#### `ses.cookies.get(filter, callback)`
### `ses.cookies.get(filter, callback)`
* `filter` Object
* `url` String (optional) - `url`에 해당하는 쿠키를 취득합니다. 이 속성을
@ -133,7 +133,7 @@ session.defaultSession.cookies.set(cookie, (error) => {
* `expirationDate` Double - (Option) UNIX 시간으로 표시되는 쿠키의 만료일에
대한 초 단위 시간. 세션 쿠키는 지원되지 않음.
#### `ses.cookies.set(details, callback)`
### `ses.cookies.set(details, callback)`
* `details` Object
* `url` String - 쿠키에 대한 `url` 링크.
@ -153,7 +153,7 @@ session.defaultSession.cookies.set(cookie, (error) => {
`details` 객체에 따라 쿠키를 설정합니다. 작업이 완료되면 `callback`
`callback(error)` 형태로 호출됩니다.
#### `ses.cookies.remove(url, name, callback)`
### `ses.cookies.remove(url, name, callback)`
* `url` String - 쿠키와 관련된 URL입니다.
* `name` String - 지울 쿠키의 이름입니다.
@ -162,20 +162,20 @@ session.defaultSession.cookies.set(cookie, (error) => {
`url``name`에 일치하는 쿠키를 삭제합니다. 작업이 완료되면 `callback`
`callback()` 형식으로 호출됩니다.
#### `ses.getCacheSize(callback)`
### `ses.getCacheSize(callback)`
* `callback` Function
* `size` Integer - 바이트로 표현된 캐시 크기
세션의 현재 캐시 크기를 반환합니다.
#### `ses.clearCache(callback)`
### `ses.clearCache(callback)`
* `callback` Function - 작업이 완료되면 호출됩니다.
세션의 HTTP 캐시를 비웁니다.
#### `ses.clearStorageData([options, ]callback)`
### `ses.clearStorageData([options, ]callback)`
* `options` Object (optional), proprties:
* `origin` String - `scheme://host:port`와 같은 `window.location.origin` 규칙을
@ -189,11 +189,11 @@ session.defaultSession.cookies.set(cookie, (error) => {
웹 스토리지의 데이터를 비웁니다.
#### `ses.flushStorageData()`
### `ses.flushStorageData()`
디스크에 사용되지 않은 DOMStorage 데이터를 모두 덮어씌웁니다.
#### `ses.setProxy(config, callback)`
### `ses.setProxy(config, callback)`
* `config` Object
* `pacScript` String - PAC 파일과 관련된 URL입니다.
@ -240,14 +240,14 @@ proxyURL = [<proxyScheme>"://"]<proxyHost>[":"<proxyPort>]
`url`의 프록시 정보를 해석합니다. `callback`은 요청이 수행되었을 때
`callback(proxy)` 형태로 호출됩니다.
#### `ses.setDownloadPath(path)`
### `ses.setDownloadPath(path)`
* `path` String - 다운로드 위치
다운로드 저장 위치를 지정합니다. 기본 다운로드 위치는 각 애플리케이션 데이터 디렉터리의
`Downloads` 폴더입니다.
#### `ses.enableNetworkEmulation(options)`
### `ses.enableNetworkEmulation(options)`
* `options` Object
* `offline` Boolean - 네트워크의 오프라인 상태 여부
@ -269,11 +269,11 @@ window.webContents.session.enableNetworkEmulation({
window.webContents.session.enableNetworkEmulation({offline: true});
```
#### `ses.disableNetworkEmulation()`
### `ses.disableNetworkEmulation()`
활성화된 `session`의 에뮬레이션을 비활성화합니다. 기본 네트워크 설정으로 돌아갑니다.
#### `ses.setCertificateVerifyProc(proc)`
### `ses.setCertificateVerifyProc(proc)`
* `proc` Function
@ -292,7 +292,7 @@ myWindow.webContents.session.setCertificateVerifyProc((hostname, cert, callback)
callback(false);
});
```
#### `ses.setPermissionRequestHandler(handler)`
### `ses.setPermissionRequestHandler(handler)`
* `handler` Function
* `webContents` Object - [WebContents](web-contents.md) 권한을 요청.
@ -317,13 +317,13 @@ session.fromPartition(partition).setPermissionRequestHandler((webContents, permi
});
```
#### `ses.clearHostResolverCache([callback])`
### `ses.clearHostResolverCache([callback])`
* `callback` Function (optional) - 작업이 완료되면 호출됩니다.
호스트 리소버(resolver) 캐시를 지웁니다.
#### `ses.allowNTLMCredentialsForDomains(domains)`
### `ses.allowNTLMCredentialsForDomains(domains)`
* `domains` String - 통합 인증을 사용하도록 설정할 쉼표로 구분된 서버의 리스트.
@ -339,7 +339,7 @@ session.defaultSession.allowNTLMCredentialsForDomains('*example.com, *foobar.com
session.defaultSession.allowNTLMCredentialsForDomains('*')
```
#### `ses.webRequest`
### `ses.webRequest`
`webRequest` API는 생명주기의 다양한 단계에 맞춰 요청 콘텐츠를 가로채거나 변경할 수
있도록 합니다.
@ -367,7 +367,7 @@ session.defaultSession.webRequest.onBeforeSendHeaders(filter, (details, callback
});
```
#### `ses.webRequest.onBeforeRequest([filter, ]listener)`
### `ses.webRequest.onBeforeRequest([filter, ]listener)`
* `filter` Object
* `listener` Function
@ -396,7 +396,7 @@ session.defaultSession.webRequest.onBeforeSendHeaders(filter, (details, callback
* `redirectURL` String (optional) - 원래 요청은 전송과 완료가 방지되지만 이
속성을 지정하면 해당 URL로 리다이렉트됩니다.
#### `ses.webRequest.onBeforeSendHeaders([filter, ]listener)`
### `ses.webRequest.onBeforeSendHeaders([filter, ]listener)`
* `filter` Object
* `listener` Function
@ -421,7 +421,7 @@ HTTP 요청을 보내기 전 요청 헤더를 사용할 수 있을 때 `listener
* `requestHeaders` Object (optional) - 이 속성이 제공되면, 요청은 이 헤더로
만들어 집니다.
#### `ses.webRequest.onSendHeaders([filter, ]listener)`
### `ses.webRequest.onSendHeaders([filter, ]listener)`
* `filter` Object
* `listener` Function
@ -438,7 +438,7 @@ HTTP 요청을 보내기 전 요청 헤더를 사용할 수 있을 때 `listener
* `timestamp` Double
* `requestHeaders` Object
#### `ses.webRequest.onHeadersReceived([filter, ]listener)`
### `ses.webRequest.onHeadersReceived([filter, ]listener)`
* `filter` Object
* `listener` Function
@ -467,7 +467,7 @@ HTTP 요청을 보내기 전 요청 헤더를 사용할 수 있을 때 `listener
변경하기 위해 반드시 지정되어야 합니다. 그렇지 않은 경우, 기존의 응답 헤더의 상태가
사용됩니다.
#### `ses.webRequest.onResponseStarted([filter, ]listener)`
### `ses.webRequest.onResponseStarted([filter, ]listener)`
* `filter` Object
* `listener` Function
@ -486,7 +486,7 @@ HTTP 요청을 보내기 전 요청 헤더를 사용할 수 있을 때 `listener
* `statusCode` Integer
* `statusLine` String
#### `ses.webRequest.onBeforeRedirect([filter, ]listener)`
### `ses.webRequest.onBeforeRedirect([filter, ]listener)`
* `filter` Object
* `listener` Function
@ -506,7 +506,7 @@ HTTP 요청을 보내기 전 요청 헤더를 사용할 수 있을 때 `listener
* `fromCache` Boolean
* `responseHeaders` Object
#### `ses.webRequest.onCompleted([filter, ]listener)`
### `ses.webRequest.onCompleted([filter, ]listener)`
* `filter` Object
* `listener` Function
@ -524,7 +524,7 @@ HTTP 요청을 보내기 전 요청 헤더를 사용할 수 있을 때 `listener
* `statusCode` Integer
* `statusLine` String
#### `ses.webRequest.onErrorOccurred([filter, ]listener)`
### `ses.webRequest.onErrorOccurred([filter, ]listener)`
* `filter` Object
* `listener` Function
@ -540,7 +540,7 @@ HTTP 요청을 보내기 전 요청 헤더를 사용할 수 있을 때 `listener
* `fromCache` Boolean
* `error` String - 에러 설명.
#### `ses.protocol`
### `ses.protocol`
현재 세션의 [protocol](protocol.md) 모듈 인스턴스를 반환합니다.

View file

@ -1022,7 +1022,7 @@ win.webContents.debugger.sendCommand('Network.enable');
지정한 커맨드를 디버깅 대상에게 전송합니다.
#### Event: 'detach'
### Event: 'detach'
* `event` Event
* `reason` String - 디버거 분리 사유.
@ -1030,7 +1030,7 @@ win.webContents.debugger.sendCommand('Network.enable');
디버깅 세션이 종료될 때 발생하는 이벤트입니다. `webContents`가 닫히거나 개발자 도구가
부착된 `webContents`에 대해 호출될 때 발생합니다.
#### Event: 'message'
### Event: 'message'
* `event` Event
* `method` String - 메서드 이름.

View file

@ -47,7 +47,7 @@ var ses = session.fromPartition('persist:name');
实例 `Session` 有以下事件:
#### Event: 'will-download'
### Event: 'will-download'
* `event` Event
* `item` [DownloadItem](download-item.md)
@ -70,7 +70,7 @@ session.defaultSession.on('will-download', function(event, item, webContents) {
实例 `Session` 有以下方法:
#### `ses.cookies`
### `ses.cookies`
`cookies` 赋予你全力来查询和修改 cookies. 例如:
@ -94,7 +94,7 @@ session.defaultSession.cookies.set(cookie, function(error) {
});
```
#### `ses.cookies.get(filter, callback)`
### `ses.cookies.get(filter, callback)`
* `filter` Object
* `url` String (可选) - 与获取 cookies 相关的
@ -123,7 +123,7 @@ session.defaultSession.cookies.set(cookie, function(error) {
cookie .
* `expirationDate` Double (可选) - cookie的截至日期数值为UNIX纪元以来的秒数. 对session cookies 不提供.
#### `ses.cookies.set(details, callback)`
### `ses.cookies.set(details, callback)`
* `details` Object
* `url` String - 与获取 cookies 相关的
@ -140,7 +140,7 @@ session.defaultSession.cookies.set(cookie, function(error) {
使用 `details` 设置 cookie, 完成时使用 `callback(error)` 掉哟个 `callback` .
#### `ses.cookies.remove(url, name, callback)`
### `ses.cookies.remove(url, name, callback)`
* `url` String - 与 cookies 相关的
`url`.
@ -149,20 +149,20 @@ session.defaultSession.cookies.set(cookie, function(error) {
删除匹配 `url``name` 的 cookie, 完成时使用 `callback()`调用`callback`.
#### `ses.getCacheSize(callback)`
### `ses.getCacheSize(callback)`
* `callback` Function
* `size` Integer - 单位 bytes 的缓存 size.
返回 session 的当前缓存 size .
#### `ses.clearCache(callback)`
### `ses.clearCache(callback)`
* `callback` Function - 操作完成时调用
清空 session 的 HTTP 缓存.
#### `ses.clearStorageData([options, ]callback)`
### `ses.clearStorageData([options, ]callback)`
* `options` Object (可选)
* `origin` String - 应当遵循 `window.location.origin` 的格式
@ -176,11 +176,11 @@ session.defaultSession.cookies.set(cookie, function(error) {
清除 web storages 的数据.
#### `ses.flushStorageData()`
### `ses.flushStorageData()`
将没有写入的 DOMStorage 写入磁盘.
#### `ses.setProxy(config, callback)`
### `ses.setProxy(config, callback)`
* `config` Object
* `pacScript` String - 与 PAC 文件相关的 URL.
@ -219,13 +219,13 @@ proxyURL = [<proxyScheme>"://"]<proxyHost>[":"<proxyPort>]
解析 `url` 的代理信息.当请求完成的时候使用 `callback(proxy)` 调用 `callback`.
#### `ses.setDownloadPath(path)`
### `ses.setDownloadPath(path)`
* `path` String - 下载地址
设置下载保存地址,默认保存地址为各自 app 应用的 `Downloads`目录.
#### `ses.enableNetworkEmulation(options)`
### `ses.enableNetworkEmulation(options)`
* `options` Object
* `offline` Boolean - 是否模拟网络故障.
@ -247,12 +247,12 @@ window.webContents.session.enableNetworkEmulation({
window.webContents.session.enableNetworkEmulation({offline: true});
```
#### `ses.disableNetworkEmulation()`
### `ses.disableNetworkEmulation()`
停止所有已经使用 `session` 的活跃模拟网络.
重置为原始网络类型.
#### `ses.setCertificateVerifyProc(proc)`
### `ses.setCertificateVerifyProc(proc)`
* `proc` Function
@ -269,7 +269,7 @@ myWindow.webContents.session.setCertificateVerifyProc(function(hostname, cert, c
});
```
#### `ses.setPermissionRequestHandler(handler)`
### `ses.setPermissionRequestHandler(handler)`
* `handler` Function
* `webContents` Object - [WebContents](web-contents.md) 请求许可.
@ -291,13 +291,13 @@ session.fromPartition(partition).setPermissionRequestHandler(function(webContent
});
```
#### `ses.clearHostResolverCache([callback])`
### `ses.clearHostResolverCache([callback])`
* `callback` Function (可选) - 操作结束调用.
清除主机解析缓存.
#### `ses.webRequest`
### `ses.webRequest`
在其生命周期的不同阶段,`webRequest` API 设置允许拦截并修改请求内容.
@ -319,7 +319,7 @@ session.defaultSession.webRequest.onBeforeSendHeaders(filter, function(details,
});
```
#### `ses.webRequest.onBeforeRequest([filter, ]listener)`
### `ses.webRequest.onBeforeRequest([filter, ]listener)`
* `filter` Object
* `listener` Function
@ -347,7 +347,7 @@ session.defaultSession.webRequest.onBeforeSendHeaders(filter, function(details,
* `cancel` Boolean (可选)
* `redirectURL` String (可选) - 原始请求阻止发送或完成,而不是重定向.
#### `ses.webRequest.onBeforeSendHeaders([filter, ]listener)`
### `ses.webRequest.onBeforeSendHeaders([filter, ]listener)`
* `filter` Object
* `listener` Function
@ -369,7 +369,7 @@ session.defaultSession.webRequest.onBeforeSendHeaders(filter, function(details,
* `cancel` Boolean (可选)
* `requestHeaders` Object (可选) - 如果提供了,将使用这些 headers 来创建请求.
#### `ses.webRequest.onSendHeaders([filter, ]listener)`
### `ses.webRequest.onSendHeaders([filter, ]listener)`
* `filter` Object
* `listener` Function
@ -384,7 +384,7 @@ session.defaultSession.webRequest.onBeforeSendHeaders(filter, function(details,
* `timestamp` Double
* `requestHeaders` Object
#### `ses.webRequest.onHeadersReceived([filter,] listener)`
### `ses.webRequest.onHeadersReceived([filter,] listener)`
* `filter` Object
* `listener` Function
@ -408,7 +408,7 @@ session.defaultSession.webRequest.onBeforeSendHeaders(filter, function(details,
* `cancel` Boolean
* `responseHeaders` Object (可选) - 如果提供, 服务器将假定使用这些头来响应.
#### `ses.webRequest.onResponseStarted([filter, ]listener)`
### `ses.webRequest.onResponseStarted([filter, ]listener)`
* `filter` Object
* `listener` Function
@ -427,7 +427,7 @@ session.defaultSession.webRequest.onBeforeSendHeaders(filter, function(details,
* `statusCode` Integer
* `statusLine` String
#### `ses.webRequest.onBeforeRedirect([filter, ]listener)`
### `ses.webRequest.onBeforeRedirect([filter, ]listener)`
* `filter` Object
* `listener` Function
@ -446,7 +446,7 @@ session.defaultSession.webRequest.onBeforeSendHeaders(filter, function(details,
* `fromCache` Boolean
* `responseHeaders` Object
#### `ses.webRequest.onCompleted([filter, ]listener)`
### `ses.webRequest.onCompleted([filter, ]listener)`
* `filter` Object
* `listener` Function
@ -464,7 +464,7 @@ session.defaultSession.webRequest.onBeforeSendHeaders(filter, function(details,
* `statusCode` Integer
* `statusLine` String
#### `ses.webRequest.onErrorOccurred([filter, ]listener)`
### `ses.webRequest.onErrorOccurred([filter, ]listener)`
* `filter` Object
* `listener` Function

View file

@ -846,14 +846,14 @@ win.webContents.debugger.sendCommand("Network.enable");
发送给定命令给调试目标.
#### Event: 'detach'
### Event: 'detach'
* `event` Event
* `reason` String - 拆分调试器原因.
在调试 session 结束时发出事件.这在 `webContents` 关闭时或 `webContents` 请求开发者工具栏时发生.
#### Event: 'message'
### Event: 'message'
* `event` Event
* `method` String - 方法名.

View file

@ -50,11 +50,11 @@ const session = require('electron').session;
const ses = session.fromPartition('persist:name');
```
### Instance Events
## Events
The following events are available on instances of `Session`:
#### Event: 'will-download'
### Event: 'will-download'
* `event` Event
* `item` [DownloadItem](download-item.md)
@ -74,11 +74,11 @@ session.defaultSession.on('will-download', (event, item, webContents) => {
});
```
### Instance Methods
## Instance Methods
The following methods are available on instances of `Session`:
#### `ses.cookies`
### `ses.cookies`
The `cookies` gives you ability to query and modify cookies. For example:
@ -102,7 +102,7 @@ session.defaultSession.cookies.set(cookie, (error) => {
});
```
#### `ses.cookies.get(filter, callback)`
### `ses.cookies.get(filter, callback)`
* `filter` Object
* `url` String (optional) - Retrieves cookies which are associated with
@ -134,7 +134,7 @@ with `callback(error, cookies)` on complete.
the number of seconds since the UNIX epoch. Not provided for session
cookies.
#### `ses.cookies.set(details, callback)`
### `ses.cookies.set(details, callback)`
* `details` Object
* `url` String - The url to associate the cookie with.
@ -154,7 +154,7 @@ with `callback(error, cookies)` on complete.
Sets a cookie with `details`, `callback` will be called with `callback(error)`
on complete.
#### `ses.cookies.remove(url, name, callback)`
### `ses.cookies.remove(url, name, callback)`
* `url` String - The URL associated with the cookie.
* `name` String - The name of cookie to remove.
@ -163,20 +163,20 @@ on complete.
Removes the cookies matching `url` and `name`, `callback` will called with
`callback()` on complete.
#### `ses.getCacheSize(callback)`
### `ses.getCacheSize(callback)`
* `callback` Function
* `size` Integer - Cache size used in bytes.
Returns the session's current cache size.
#### `ses.clearCache(callback)`
### `ses.clearCache(callback)`
* `callback` Function - Called when operation is done
Clears the sessions HTTP cache.
#### `ses.clearStorageData([options, ]callback)`
### `ses.clearStorageData([options, ]callback)`
* `options` Object (optional)
* `origin` String - Should follow `window.location.origin`s representation
@ -190,11 +190,11 @@ Clears the sessions HTTP cache.
Clears the data of web storages.
#### `ses.flushStorageData()`
### `ses.flushStorageData()`
Writes any unwritten DOMStorage data to disk.
#### `ses.setProxy(config, callback)`
### `ses.setProxy(config, callback)`
* `config` Object
* `pacScript` String - The URL associated with the PAC file.
@ -239,14 +239,14 @@ For example:
Resolves the proxy information for `url`. The `callback` will be called with
`callback(proxy)` when the request is performed.
#### `ses.setDownloadPath(path)`
### `ses.setDownloadPath(path)`
* `path` String - The download location
Sets download saving directory. By default, the download directory will be the
`Downloads` under the respective app folder.
#### `ses.enableNetworkEmulation(options)`
### `ses.enableNetworkEmulation(options)`
* `options` Object
* `offline` Boolean - Whether to emulate network outage.
@ -268,12 +268,12 @@ window.webContents.session.enableNetworkEmulation({
window.webContents.session.enableNetworkEmulation({offline: true});
```
#### `ses.disableNetworkEmulation()`
### `ses.disableNetworkEmulation()`
Disables any network emulation already active for the `session`. Resets to
the original network configuration.
#### `ses.setCertificateVerifyProc(proc)`
### `ses.setCertificateVerifyProc(proc)`
* `proc` Function
@ -294,7 +294,7 @@ myWindow.webContents.session.setCertificateVerifyProc((hostname, cert, callback)
});
```
#### `ses.setPermissionRequestHandler(handler)`
### `ses.setPermissionRequestHandler(handler)`
* `handler` Function
* `webContents` Object - [WebContents](web-contents.md) requesting the permission.
@ -318,13 +318,13 @@ session.fromPartition(partition).setPermissionRequestHandler((webContents, permi
});
```
#### `ses.clearHostResolverCache([callback])`
### `ses.clearHostResolverCache([callback])`
* `callback` Function (optional) - Called when operation is done.
Clears the host resolver cache.
#### `ses.allowNTLMCredentialsForDomains(domains)`
### `ses.allowNTLMCredentialsForDomains(domains)`
* `domains` String - A comma-seperated list of servers for which
integrated authentication is enabled.
@ -341,7 +341,7 @@ session.defaultSession.allowNTLMCredentialsForDomains('*example.com, *foobar.com
session.defaultSession.allowNTLMCredentialsForDomains('*')
```
#### `ses.webRequest`
### `ses.webRequest`
The `webRequest` API set allows to intercept and modify contents of a request at
various stages of its lifetime.
@ -370,7 +370,7 @@ session.defaultSession.webRequest.onBeforeSendHeaders(filter, (details, callback
});
```
#### `ses.webRequest.onBeforeRequest([filter, ]listener)`
### `ses.webRequest.onBeforeRequest([filter, ]listener)`
* `filter` Object
* `listener` Function
@ -400,7 +400,7 @@ The `callback` has to be called with an `response` object:
* `redirectURL` String (optional) - The original request is prevented from
being sent or completed, and is instead redirected to the given URL.
#### `ses.webRequest.onBeforeSendHeaders([filter, ]listener)`
### `ses.webRequest.onBeforeSendHeaders([filter, ]listener)`
* `filter` Object
* `listener` Function
@ -425,7 +425,7 @@ The `callback` has to be called with an `response` object:
* `requestHeaders` Object (optional) - When provided, request will be made
with these headers.
#### `ses.webRequest.onSendHeaders([filter, ]listener)`
### `ses.webRequest.onSendHeaders([filter, ]listener)`
* `filter` Object
* `listener` Function
@ -442,7 +442,7 @@ response are visible by the time this listener is fired.
* `timestamp` Double
* `requestHeaders` Object
#### `ses.webRequest.onHeadersReceived([filter,]listener)`
### `ses.webRequest.onHeadersReceived([filter,]listener)`
* `filter` Object
* `listener` Function
@ -471,7 +471,7 @@ The `callback` has to be called with an `response` object:
`responseHeaders` to change header status otherwise original response
header's status will be used.
#### `ses.webRequest.onResponseStarted([filter, ]listener)`
### `ses.webRequest.onResponseStarted([filter, ]listener)`
* `filter` Object
* `listener` Function
@ -492,7 +492,7 @@ and response headers are available.
* `statusCode` Integer
* `statusLine` String
#### `ses.webRequest.onBeforeRedirect([filter, ]listener)`
### `ses.webRequest.onBeforeRedirect([filter, ]listener)`
* `filter` Object
* `listener` Function
@ -513,7 +513,7 @@ redirect is about to occur.
* `fromCache` Boolean
* `responseHeaders` Object
#### `ses.webRequest.onCompleted([filter, ]listener)`
### `ses.webRequest.onCompleted([filter, ]listener)`
* `filter` Object
* `listener` Function
@ -532,7 +532,7 @@ completed.
* `statusCode` Integer
* `statusLine` String
#### `ses.webRequest.onErrorOccurred([filter, ]listener)`
### `ses.webRequest.onErrorOccurred([filter, ]listener)`
* `filter` Object
* `listener` Function
@ -548,7 +548,7 @@ The `listener` will be called with `listener(details)` when an error occurs.
* `fromCache` Boolean
* `error` String - The error description.
#### `ses.protocol`
### `ses.protocol`
Returns an instance of [protocol](protocol.md) module for this session.

View file

@ -1035,7 +1035,7 @@ Detaches the debugger from the `webContents`.
Send given command to the debugging target.
#### Event: 'detach'
### Event: 'detach'
* `event` Event
* `reason` String - Reason for detaching debugger.
@ -1043,7 +1043,7 @@ Send given command to the debugging target.
Emitted when debugging session is terminated. This happens either when
`webContents` is closed or devtools is invoked for the attached `webContents`.
#### Event: 'message'
### Event: 'message'
* `event` Event
* `method` String - Method name.