summaryrefslogtreecommitdiff
path: root/ext/net
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-01-20 16:32:55 +0100
committerGitHub <noreply@github.com>2023-01-20 16:32:55 +0100
commitda23f7f8763cab90fbbf37d9c7cddf3758d7d364 (patch)
treeca96f1228b1d0986124cf54d949baf19418e3937 /ext/net
parentc230a955518eef34af04fffad92ec915f29a58bd (diff)
feat: Stabilize Deno.Listener.ref/unref (#17477)
Diffstat (limited to 'ext/net')
-rw-r--r--ext/net/01_net.js8
-rw-r--r--ext/net/lib.deno_net.d.ts11
2 files changed, 11 insertions, 8 deletions
diff --git a/ext/net/01_net.js b/ext/net/01_net.js
index c15ff56af..a6043786f 100644
--- a/ext/net/01_net.js
+++ b/ext/net/01_net.js
@@ -408,15 +408,7 @@
}
}
- function setup(unstable) {
- if (!unstable) {
- delete Listener.prototype.ref;
- delete Listener.prototype.unref;
- }
- }
-
window.__bootstrap.net = {
- setup,
connect,
Conn,
TcpConn,
diff --git a/ext/net/lib.deno_net.d.ts b/ext/net/lib.deno_net.d.ts
index 6a3da03c3..ce0efdad2 100644
--- a/ext/net/lib.deno_net.d.ts
+++ b/ext/net/lib.deno_net.d.ts
@@ -37,6 +37,17 @@ declare namespace Deno {
readonly rid: number;
[Symbol.asyncIterator](): AsyncIterableIterator<Conn>;
+
+ /**
+ * Make the listener block the event loop from finishing.
+ *
+ * Note: the listener blocks the event loop from finishing by default.
+ * This method is only meaningful after `.unref()` is called.
+ */
+ ref(): void;
+
+ /** Make the listener not block the event loop from finishing. */
+ unref(): void;
}
/** Specialized listener that accepts TLS connections.