summaryrefslogtreecommitdiff
path: root/cli/js/web/blob.ts
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2020-03-29 04:03:49 +1100
committerGitHub <noreply@github.com>2020-03-28 13:03:49 -0400
commitbced52505f32d6cca4f944bb610a8a26767908a8 (patch)
treeda49a5df4b7bd6f8306248069228cd6bd0db1303 /cli/js/web/blob.ts
parent1397b8e0e7c85762e19d88fde103342bfa563360 (diff)
Update to Prettier 2 and use ES Private Fields (#4498)
Diffstat (limited to 'cli/js/web/blob.ts')
-rw-r--r--cli/js/web/blob.ts11
1 files changed, 2 insertions, 9 deletions
diff --git a/cli/js/web/blob.ts b/cli/js/web/blob.ts
index 31674a62d..5309ddaf4 100644
--- a/cli/js/web/blob.ts
+++ b/cli/js/web/blob.ts
@@ -124,12 +124,8 @@ function processBlobParts(
return bytes;
}
-// A WeakMap holding blob to byte array mapping.
-// Ensures it does not impact garbage collection.
-export const blobBytesWeakMap = new WeakMap<domTypes.Blob, Uint8Array>();
-
export class DenoBlob implements domTypes.Blob {
- private readonly [bytesSymbol]: Uint8Array;
+ [bytesSymbol]: Uint8Array;
readonly size: number = 0;
readonly type: string = "";
@@ -165,14 +161,11 @@ export class DenoBlob implements domTypes.Blob {
this[bytesSymbol] = bytes;
this.size = bytes.byteLength;
this.type = normalizedType;
-
- // Register bytes for internal private use.
- blobBytesWeakMap.set(this, bytes);
}
slice(start?: number, end?: number, contentType?: string): DenoBlob {
return new DenoBlob([this[bytesSymbol].slice(start, end)], {
- type: contentType || this.type
+ type: contentType || this.type,
});
}
}