1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-11 08:33:43 -05:00

feat: Stabilize Deno.Listener.ref/unref (#17477)

This commit is contained in:
Bartek Iwańczuk 2023-01-20 16:32:55 +01:00 committed by GitHub
parent c230a95551
commit da23f7f876
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 28 deletions

View file

@ -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.

View file

@ -408,15 +408,7 @@
}
}
function setup(unstable) {
if (!unstable) {
delete Listener.prototype.ref;
delete Listener.prototype.unref;
}
}
window.__bootstrap.net = {
setup,
connect,
Conn,
TcpConn,

View file

@ -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.

View file

@ -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;