diff options
author | Luca Casonato <lucacasonato@yahoo.com> | 2020-04-30 17:23:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-30 11:23:40 -0400 |
commit | 80e22111416751ce34dbc5cb32ffa9f293517370 (patch) | |
tree | 5b3fe5d16ee07143e5dcb2c766a1f48c296ad9d6 /cli/js/net.ts | |
parent | 4993a6504b4b447e0e02454094cffb02ee18c081 (diff) |
Unstable methods should not appear in runtime or d.ts (#4957)
Co-authored-by: Kitson Kelly <me@kitsonkelly.com>
Diffstat (limited to 'cli/js/net.ts')
-rw-r--r-- | cli/js/net.ts | 52 |
1 files changed, 8 insertions, 44 deletions
diff --git a/cli/js/net.ts b/cli/js/net.ts index b06a4189a..5094351b2 100644 --- a/cli/js/net.ts +++ b/cli/js/net.ts @@ -48,6 +48,7 @@ export class ConnImpl implements Conn { close(this.rid); } + // TODO(lucacasonato): make this unavailable in stable closeWrite(): void { netOps.shutdown(this.rid, netOps.ShutdownMode.Write); } @@ -141,59 +142,22 @@ export interface Conn extends Reader, Writer, Closer { export interface ListenOptions { port: number; hostname?: string; - transport?: "tcp" | "udp"; -} - -export interface UnixListenOptions { - transport: "unix" | "unixpacket"; - path: string; + transport?: "tcp"; } export function listen( options: ListenOptions & { transport?: "tcp" } ): Listener; -export function listen( - options: UnixListenOptions & { transport: "unix" } -): Listener; -export function listen(options: ListenOptions | UnixListenOptions): Listener { - let res; - - if (options.transport === "unix") { - res = netOps.listen(options); - } else { - res = netOps.listen({ - transport: "tcp", - hostname: "127.0.0.1", - ...(options as ListenOptions), - }); - } +export function listen(options: ListenOptions): Listener { + const res = netOps.listen({ + transport: "tcp", + hostname: "127.0.0.1", + ...(options as ListenOptions), + }); return new ListenerImpl(res.rid, res.localAddr); } -export function listenDatagram( - options: ListenOptions & { transport: "udp" } -): DatagramConn; -export function listenDatagram( - options: UnixListenOptions & { transport: "unixpacket" } -): DatagramConn; -export function listenDatagram( - options: ListenOptions | UnixListenOptions -): DatagramConn { - let res; - if (options.transport === "unixpacket") { - res = netOps.listen(options); - } else { - res = netOps.listen({ - transport: "udp", - hostname: "127.0.0.1", - ...(options as ListenOptions), - }); - } - - return new DatagramImpl(res.rid, res.localAddr); -} - export interface ConnectOptions { port: number; hostname?: string; |