1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-25 15:29:32 -05:00

fix DenoBlob name (#5879)

This commit is contained in:
Peter Evers 2020-05-29 08:27:57 +02:00 committed by GitHub
parent 55311c33c4
commit fe7d6824c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View file

@ -161,7 +161,7 @@ async function readBytes(
// Ensures it does not impact garbage collection.
export const blobBytesWeakMap = new WeakMap<Blob, Uint8Array>();
export class DenoBlob implements Blob {
class DenoBlob implements Blob {
[bytesSymbol]: Uint8Array;
readonly size: number = 0;
readonly type: string = "";
@ -216,3 +216,11 @@ export class DenoBlob implements Blob {
return readBytes(getStream(this[bytesSymbol]).getReader());
}
}
// we want the Base class name to be the name of the class.
Object.defineProperty(DenoBlob, "name", {
value: "Blob",
configurable: true,
});
export { DenoBlob };

View file

@ -90,3 +90,8 @@ unitTest(async function blobStream(): Promise<void> {
await read();
assertEquals(decode(bytes), "Hello World");
});
unitTest(function blobConstructorNameIsBlob(): void {
const blob = new Blob();
assertEquals(blob.constructor.name, "Blob");
});