mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 17:34:47 -05:00
perf(fetch): optimize InnerBody constructor (#12232)
Avoid initializers due to overhead
This commit is contained in:
parent
2b6f8d0187
commit
7f2976b3e6
1 changed files with 5 additions and 7 deletions
|
@ -36,19 +36,17 @@
|
|||
} = window.__bootstrap.primordials;
|
||||
|
||||
class InnerBody {
|
||||
/** @type {ReadableStream<Uint8Array> | { body: Uint8Array, consumed: boolean }} */
|
||||
streamOrStatic;
|
||||
/** @type {null | Uint8Array | Blob | FormData} */
|
||||
source = null;
|
||||
/** @type {null | number} */
|
||||
length = null;
|
||||
|
||||
/**
|
||||
* @param {ReadableStream<Uint8Array> | { body: Uint8Array, consumed: boolean }} stream
|
||||
*/
|
||||
constructor(stream) {
|
||||
/** @type {ReadableStream<Uint8Array> | { body: Uint8Array, consumed: boolean }} */
|
||||
this.streamOrStatic = stream ??
|
||||
{ body: new Uint8Array(), consumed: false };
|
||||
/** @type {null | Uint8Array | Blob | FormData} */
|
||||
this.source = null;
|
||||
/** @type {null | number} */
|
||||
this.length = null;
|
||||
}
|
||||
|
||||
get stream() {
|
||||
|
|
Loading…
Add table
Reference in a new issue