Translated API docs, added power-save-blocker API to README
This commit is contained in:
parent
783e4bc591
commit
dcd10d1e4b
19 changed files with 138 additions and 170 deletions
|
@ -1,10 +1,8 @@
|
|||
# protocol
|
||||
|
||||
The `protocol` module can register a new protocol or intercept an existing
|
||||
protocol, so you can customize the response to the requests for various protocols.
|
||||
`protocol` 모듈은 여러 프로토콜의 요청과 응답을 커스터마이즈 할 수 있도록 이미 있는 프로토콜을 변경하거나 새로운 프로토콜을 만드는 방법을 제공합니다.
|
||||
|
||||
An example of implementing a protocol that has the same effect with the
|
||||
`file://` protocol:
|
||||
다음 예제는 `file://` 프로토콜과 같은 일을 하는 커스텀 프로토콜을 설정합니다:
|
||||
|
||||
```javascript
|
||||
var app = require('app');
|
||||
|
@ -19,67 +17,63 @@ app.on('ready', function() {
|
|||
});
|
||||
```
|
||||
|
||||
**Note:** This module can only be used after the `ready` event
|
||||
was emitted.
|
||||
**알림:** 이 모듈은 app의 `ready` 이벤트가 발생한 이후에만 사용할 수 있습니다.
|
||||
|
||||
## protocol.registerProtocol(scheme, handler)
|
||||
|
||||
* `scheme` String
|
||||
* `handler` Function
|
||||
|
||||
Registers a custom protocol of `scheme`, the `handler` would be called with
|
||||
`handler(request)` when the a request with registered `scheme` is made.
|
||||
지정한 `scheme`을 기반으로 커스텀 프로토콜을 등록합니다. 등록한 `scheme` 프로토콜에 요청이 들어올 경우 `request` 인자와 함께 `handler` 함수가 호출됩니다.
|
||||
|
||||
You need to return a request job in the `handler` to specify which type of
|
||||
response you would like to send.
|
||||
호출된 `handler` 함수에선 요청에 대한 해당 프로토콜의 작업 결과를 응답(반환) 해야 할 필요가 있습니다.
|
||||
|
||||
## protocol.unregisterProtocol(scheme)
|
||||
|
||||
* `scheme` String
|
||||
|
||||
Unregisters the custom protocol of `scheme`.
|
||||
지정한 `scheme` 프로토콜을 등록 해제합니다.
|
||||
|
||||
## protocol.registerStandardSchemes(value)
|
||||
|
||||
* `value` Array
|
||||
|
||||
`value` is an array of custom schemes to be registered to the standard.
|
||||
지정한 `value` 배열을 사용하여 미리 지정된 스킴으로 등록합니다.
|
||||
|
||||
## protocol.isHandledProtocol(scheme)
|
||||
|
||||
* `scheme` String
|
||||
|
||||
Returns whether the `scheme` can be handled already.
|
||||
해당 `scheme`에 처리자(handler)가 등록되었는지 확인합니다.
|
||||
|
||||
## protocol.interceptProtocol(scheme, handler)
|
||||
|
||||
* `scheme` String
|
||||
* `handler` Function
|
||||
|
||||
Intercepts an existing protocol with `scheme`, returning `null` or `undefined`
|
||||
in `handler` would use the original protocol handler to handle the request.
|
||||
지정한 `scheme`의 작업을 `handler`로 변경합니다.
|
||||
`handler`에서 `null` 또는 `undefined`를 반환 할 경우 해당 프로토콜의 기본 동작(응답)으로 대체 됩니다.
|
||||
|
||||
## protocol.uninterceptProtocol(scheme)
|
||||
|
||||
* `scheme` String
|
||||
|
||||
Unintercepts a protocol.
|
||||
변경된 프로토콜의 작업을 해제합니다.
|
||||
|
||||
## Class: protocol.RequestFileJob(path)
|
||||
|
||||
* `path` String
|
||||
|
||||
Create a request job which would query a file of `path` and set corresponding
|
||||
mime types.
|
||||
`path` 경로를 기반으로 파일을 반환하는 request 작업을 생성합니다. 그리고 해당 파일에 상응하는 mime type을 지정합니다.
|
||||
|
||||
## Class: protocol.RequestStringJob(options)
|
||||
|
||||
* `options` Object
|
||||
* `mimeType` String - Default is `text/plain`
|
||||
* `charset` String - Default is `UTF-8`
|
||||
* `mimeType` String - `text/plain`이 기본
|
||||
* `charset` String - `UTF-8`이 기본
|
||||
* `data` String
|
||||
|
||||
Create a request job which sends a string as response.
|
||||
문자열을 반환하는 request 작업을 생성합니다.
|
||||
|
||||
## Class: protocol.RequestBufferJob(options)
|
||||
|
||||
|
@ -88,7 +82,7 @@ Create a request job which sends a string as response.
|
|||
* `encoding` String - Default is `UTF-8`
|
||||
* `data` Buffer
|
||||
|
||||
Create a request job which sends a buffer as response.
|
||||
버퍼를 반환하는 request 작업을 생성합니다.
|
||||
|
||||
## Class: protocol.RequestHttpJob(options)
|
||||
|
||||
|
@ -97,17 +91,16 @@ Create a request job which sends a buffer as response.
|
|||
* `method` String - Default is `GET`
|
||||
* `referrer` String
|
||||
|
||||
Send a request to `url` and pipe the response back.
|
||||
`url`의 요청 결과를 그대로 반환하는 request 작업을 생성합니다.
|
||||
|
||||
## Class: protocol.RequestErrorJob(code)
|
||||
|
||||
* `code` Integer
|
||||
|
||||
Create a request job which sets appropriate network error message to console.
|
||||
Default message is `net::ERR_NOT_IMPLEMENTED`. Code should be in the following
|
||||
range.
|
||||
콘솔에 특정한 네트워크 에러 메시지를 설정하는 request 작업을 생성합니다.
|
||||
기본 메시지는 `net::ERR_NOT_IMPLEMENTED`입니다. 사용할 수 있는 코드의 범위는 다음과 같습니다.
|
||||
|
||||
* Ranges:
|
||||
* 범위:
|
||||
* 0- 99 System related errors
|
||||
* 100-199 Connection related errors
|
||||
* 200-299 Certificate errors
|
||||
|
@ -118,4 +111,4 @@ range.
|
|||
* 700-799 Certificate manager errors
|
||||
* 800-899 DNS resolver errors
|
||||
|
||||
Check the [network error list](https://code.google.com/p/chromium/codesearch#chromium/src/net/base/net_error_list.h) for code and message relations.
|
||||
에러 코드와 메시지에 대해 자세하게 알아보려면 [네트워크 에러 리스트](https://code.google.com/p/chromium/codesearch#chromium/src/net/base/net_error_list.h)를 참고하기 바랍니다.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue