Skip to content

Commit

Permalink
增加Deno.shutdown及枚举ShutdownMode的翻译
Browse files Browse the repository at this point in the history
POSIX左右加空格保证可读性
  • Loading branch information
louisliu committed Apr 15, 2020
1 parent 744023e commit 24e2119
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion lib.deno.ns.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1818,10 +1818,15 @@ declare namespace Deno {
* Corresponds to `SHUT_RD`, `SHUT_WR`, `SHUT_RDWR` on POSIX-like systems.
*
* See: http://man7.org/linux/man-pages/man2/shutdown.2.html */
/** **不稳定的**:可能会完全删除 `ShutdownMode`。
*
* 对应类 POSIX 系统上的 `SHUT_RD`,`SHUT_WR`,`SHUT_RDWR`。
*
* 参阅:http://man7.org/linux/man-pages/man2/shutdown.2.html */
export enum ShutdownMode {
Read = 0,
Write,
ReadWrite, // TODO(ry) panics on ReadWrite.
ReadWrite, // TODO(ry) panics on ReadWrite. // TODO(ry) ReadWrite上的异常。
}

/** **UNSTABLE**: Both the `how` parameter and `ShutdownMode` enum are under
Expand All @@ -1835,6 +1840,16 @@ declare namespace Deno {
* const conn = await listener.accept();
* Deno.shutdown(conn.rid, Deno.ShutdownMode.Write);
*/
/** **不稳定的**:参数 `how` 和 枚举 `ShutdownMode` 都在考虑移除。
*
* Shutdown套接字的发送和接收操作。
*
* 与POSIX的shutdown(3)行为一致。
*
* const listener = Deno.listen({ port: 80 });
* const conn = await listener.accept();
* Deno.shutdown(conn.rid, Deno.ShutdownMode.Write);
*/
export function shutdown(rid: number, how: ShutdownMode): void;

/** **UNSTABLE**: new API, yet to be vetted.
Expand Down

0 comments on commit 24e2119

Please sign in to comment.