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:
parent
c230a95551
commit
da23f7f876
4 changed files with 11 additions and 28 deletions
17
cli/tsc/dts/lib.deno.unstable.d.ts
vendored
17
cli/tsc/dts/lib.deno.unstable.d.ts
vendored
|
@ -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.
|
||||
|
|
|
@ -408,15 +408,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
function setup(unstable) {
|
||||
if (!unstable) {
|
||||
delete Listener.prototype.ref;
|
||||
delete Listener.prototype.unref;
|
||||
}
|
||||
}
|
||||
|
||||
window.__bootstrap.net = {
|
||||
setup,
|
||||
connect,
|
||||
Conn,
|
||||
TcpConn,
|
||||
|
|
11
ext/net/lib.deno_net.d.ts
vendored
11
ext/net/lib.deno_net.d.ts
vendored
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue