diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-01-20 16:32:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-20 16:32:55 +0100 |
commit | da23f7f8763cab90fbbf37d9c7cddf3758d7d364 (patch) | |
tree | ca96f1228b1d0986124cf54d949baf19418e3937 | |
parent | c230a955518eef34af04fffad92ec915f29a58bd (diff) |
feat: Stabilize Deno.Listener.ref/unref (#17477)
-rw-r--r-- | cli/tsc/dts/lib.deno.unstable.d.ts | 17 | ||||
-rw-r--r-- | ext/net/01_net.js | 8 | ||||
-rw-r--r-- | ext/net/lib.deno_net.d.ts | 11 | ||||
-rw-r--r-- | runtime/js/99_main.js | 3 |
4 files changed, 11 insertions, 28 deletions
diff --git a/cli/tsc/dts/lib.deno.unstable.d.ts b/cli/tsc/dts/lib.deno.unstable.d.ts index e3ae8f46f..7ca089108 100644 --- a/cli/tsc/dts/lib.deno.unstable.d.ts +++ b/cli/tsc/dts/lib.deno.unstable.d.ts @@ -1082,23 +1082,6 @@ declare namespace Deno { alpnProtocols?: string[]; } - /** @category Network */ - export interface Listener extends AsyncIterable<Conn> { - /** **UNSTABLE**: New API, yet to be vetted. - * - * 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; - /** **UNSTABLE**: New API, yet to be vetted. - * - * Make the listener not block the event loop from finishing. - */ - unref(): void; - } - /** **UNSTABLE**: New API, yet to be vetted. * * Acquire an advisory file-system lock for the provided file. 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. diff --git a/runtime/js/99_main.js b/runtime/js/99_main.js index 4fd6644db..ea519cb35 100644 --- a/runtime/js/99_main.js +++ b/runtime/js/99_main.js @@ -52,7 +52,6 @@ delete Intl.v8BreakIterator; const quoteString = window.__bootstrap.console.quoteString; const internals = window.__bootstrap.internals; const performance = window.__bootstrap.performance; - const net = window.__bootstrap.net; const url = window.__bootstrap.url; const fetch = window.__bootstrap.fetch; const messagePort = window.__bootstrap.messagePort; @@ -397,7 +396,6 @@ delete Intl.v8BreakIterator; core.initializeAsyncOps(); performance.setTimeOrigin(DateNow()); - net.setup(runtimeOptions.unstableFlag); const consoleFromV8 = window.Deno.core.console; const wrapConsole = window.__bootstrap.console.wrapConsole; @@ -542,7 +540,6 @@ delete Intl.v8BreakIterator; core.initializeAsyncOps(); performance.setTimeOrigin(DateNow()); - net.setup(runtimeOptions.unstableFlag); const consoleFromV8 = window.Deno.core.console; const wrapConsole = window.__bootstrap.console.wrapConsole; |