summaryrefslogtreecommitdiff
path: root/ext/net/lib.deno_net.d.ts
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2022-12-28 10:29:48 +0100
committerGitHub <noreply@github.com>2022-12-28 10:29:48 +0100
commitbece1ce05704d9a81efd2e04a22ee721795903e7 (patch)
tree1da9f477eef90e3837a2366bec0bdd9f8a79b3c0 /ext/net/lib.deno_net.d.ts
parent7ce2b58bcf412924464578f3469c210b34894c8b (diff)
feat(unstable): Add Deno.Conn.ref()/unref() (#17170)
This commit adds "Deno.Conn.ref()" and "Deno.Conn.unref()" methods. These methods can be used to make connection block or not block the event loop from finishing. Refing/unrefing only influences "read" operations - ie. scheduling writes to a connection _do_ keep event loop alive. Required for https://github.com/denoland/deno/issues/16710
Diffstat (limited to 'ext/net/lib.deno_net.d.ts')
-rw-r--r--ext/net/lib.deno_net.d.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/ext/net/lib.deno_net.d.ts b/ext/net/lib.deno_net.d.ts
index 639d0f8af..136723262 100644
--- a/ext/net/lib.deno_net.d.ts
+++ b/ext/net/lib.deno_net.d.ts
@@ -61,6 +61,20 @@ declare namespace Deno {
* callers should just use `close()`. */
closeWrite(): Promise<void>;
+ /** **UNSTABLE**: New API, yet to be vetted.
+ *
+ * Make the connection block the event loop from finishing.
+ *
+ * Note: the connection blocks the event loop from finishing by default.
+ * This method is only meaningful after `.unref()` is called.
+ */
+ ref(): void;
+ /** **UNSTABLE**: New API, yet to be vetted.
+ *
+ * Make the connection not block the event loop from finishing.
+ */
+ unref(): void;
+
readonly readable: ReadableStream<Uint8Array>;
readonly writable: WritableStream<Uint8Array>;
}