From 1b6181e434422d3fe5aa49f59f1e7adc4ec4ce8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Tue, 28 Apr 2020 21:46:39 +0200 Subject: refactor: factor out datagram from Deno.listen(), make it unstable (#4968) This commit changes Deno.listen() API by factoring out datagram listeners to Deno.listenDatagram(). New Deno.listenDatagram() is unstable. --- cli/js/lib.deno.ns.d.ts | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) (limited to 'cli/js/lib.deno.ns.d.ts') diff --git a/cli/js/lib.deno.ns.d.ts b/cli/js/lib.deno.ns.d.ts index db89ed97f..4659c1ff7 100644 --- a/cli/js/lib.deno.ns.d.ts +++ b/cli/js/lib.deno.ns.d.ts @@ -1920,9 +1920,7 @@ declare namespace Deno { /** A Path to the Unix Socket. */ path: string; } - /** **UNSTABLE**: new API, yet to be vetted. - * - * Listen announces on the local transport address. + /** Listen announces on the local transport address. * * const listener1 = Deno.listen({ port: 80 }) * const listener2 = Deno.listen({ hostname: "192.0.2.1", port: 80 }) @@ -1933,9 +1931,7 @@ declare namespace Deno { export function listen( options: ListenOptions & { transport?: "tcp" } ): Listener; - /** **UNSTABLE**: new API, yet to be vetted. - * - * Listen announces on the local transport address. + /** Listen announces on the local transport address. * * const listener = Deno.listen({ path: "/foo/bar.sock", transport: "unix" }) * @@ -1943,25 +1939,37 @@ declare namespace Deno { export function listen( options: UnixListenOptions & { transport: "unix" } ): Listener; - /** **UNSTABLE**: new API, yet to be vetted. + + /** **UNSTABLE**: new API * * Listen announces on the local transport address. * - * const listener1 = Deno.listen({ port: 80, transport: "udp" }) - * const listener2 = Deno.listen({ hostname: "golang.org", port: 80, transport: "udp" }); + * const listener1 = Deno.listenDatagram({ + * port: 80, + * transport: "udp" + * }); + * const listener2 = Deno.listenDatagram({ + * hostname: "golang.org", + * port: 80, + * transport: "udp" + * }); * * Requires `allow-net` permission. */ - export function listen( + export function listenDatagram( options: ListenOptions & { transport: "udp" } ): DatagramConn; - /** **UNSTABLE**: new API, yet to be vetted. + + /** **UNSTABLE**: new API * * Listen announces on the local transport address. * - * const listener = Deno.listen({ path: "/foo/bar.sock", transport: "unixpacket" }) + * const listener = Deno.listenDatagram({ + * address: "/foo/bar.sock", + * transport: "unixpacket" + * }); * * Requires `allow-read` and `allow-write` permission. */ - export function listen( + export function listenDatagram( options: UnixListenOptions & { transport: "unixpacket" } ): DatagramConn; -- cgit v1.2.3