dedup type declarations (#4718)

Blob, BlobPart, BufferSource, ReferrerPolicy, BlobPart, AbortSignal, AbortSignalEventMap
This commit is contained in:
Ryan Dahl 2020-04-11 16:25:31 -04:00 committed by GitHub
parent 0641ad0d9b
commit da28fc1e7b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 16 additions and 81 deletions

View file

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