mirror of
https://github.com/denoland/deno.git
synced 2025-07-31 00:54:18 +00:00
dedup type declarations (#4718)
Blob, BlobPart, BufferSource, ReferrerPolicy, BlobPart, AbortSignal, AbortSignalEventMap
This commit is contained in:
parent
0641ad0d9b
commit
da28fc1e7b
8 changed files with 16 additions and 81 deletions
|
@ -63,7 +63,7 @@ function collectSequenceNotCRLF(
|
|||
}
|
||||
|
||||
function toUint8Arrays(
|
||||
blobParts: domTypes.BlobPart[],
|
||||
blobParts: BlobPart[],
|
||||
doNormalizeLineEndingsToNative: boolean
|
||||
): Uint8Array[] {
|
||||
const ret: Uint8Array[] = [];
|
||||
|
@ -102,7 +102,7 @@ function toUint8Arrays(
|
|||
}
|
||||
|
||||
function processBlobParts(
|
||||
blobParts: domTypes.BlobPart[],
|
||||
blobParts: BlobPart[],
|
||||
options: domTypes.BlobPropertyBag
|
||||
): Uint8Array {
|
||||
const normalizeLineEndingsToNative = options.ending === "native";
|
||||
|
@ -164,17 +164,14 @@ async function readBytes(
|
|||
|
||||
// A WeakMap holding blob to byte array mapping.
|
||||
// Ensures it does not impact garbage collection.
|
||||
export const blobBytesWeakMap = new WeakMap<domTypes.Blob, Uint8Array>();
|
||||
export const blobBytesWeakMap = new WeakMap<Blob, Uint8Array>();
|
||||
|
||||
export class DenoBlob implements domTypes.Blob {
|
||||
export class DenoBlob implements Blob {
|
||||
[bytesSymbol]: Uint8Array;
|
||||
readonly size: number = 0;
|
||||
readonly type: string = "";
|
||||
|
||||
constructor(
|
||||
blobParts?: domTypes.BlobPart[],
|
||||
options?: domTypes.BlobPropertyBag
|
||||
) {
|
||||
constructor(blobParts?: BlobPart[], options?: domTypes.BlobPropertyBag) {
|
||||
if (arguments.length === 0) {
|
||||
this[bytesSymbol] = new Uint8Array();
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue