From 6236252c66301d364159bf35e17ca20ea40ed53e Mon Sep 17 00:00:00 2001 From: Peter Indiola Date: Tue, 9 Jun 2020 00:24:51 +0800 Subject: [PATCH] feat(cli/js/net): make rid on listener public (#5571) --- cli/js/lib.deno.ns.d.ts | 3 +++ cli/js/net.ts | 2 ++ cli/tests/unit/net_test.ts | 2 ++ 3 files changed, 7 insertions(+) diff --git a/cli/js/lib.deno.ns.d.ts b/cli/js/lib.deno.ns.d.ts index be4b1f15dd..63e9b342ed 100644 --- a/cli/js/lib.deno.ns.d.ts +++ b/cli/js/lib.deno.ns.d.ts @@ -1545,6 +1545,9 @@ declare namespace Deno { /** Return the address of the `Listener`. */ readonly addr: Addr; + /** Return the rid of the `Listener`. */ + readonly rid: number; + [Symbol.asyncIterator](): AsyncIterableIterator; } diff --git a/cli/js/net.ts b/cli/js/net.ts index 0c40cceae3..2de44c2acc 100644 --- a/cli/js/net.ts +++ b/cli/js/net.ts @@ -26,6 +26,8 @@ export interface Listener extends AsyncIterable { addr: Addr; + rid: number; + [Symbol.asyncIterator](): AsyncIterableIterator; } diff --git a/cli/tests/unit/net_test.ts b/cli/tests/unit/net_test.ts index 9e9a1e5e8f..4fd253a6c9 100644 --- a/cli/tests/unit/net_test.ts +++ b/cli/tests/unit/net_test.ts @@ -4,6 +4,7 @@ import { assert, assertEquals, createResolvable, + assertNotEquals, } from "./test_util.ts"; unitTest({ perms: { net: true } }, function netTcpListenClose(): void { @@ -11,6 +12,7 @@ unitTest({ perms: { net: true } }, function netTcpListenClose(): void { assert(listener.addr.transport === "tcp"); assertEquals(listener.addr.hostname, "127.0.0.1"); assertEquals(listener.addr.port, 3500); + assertNotEquals(listener.rid, 0); listener.close(); });