mirror of
https://github.com/denoland/deno.git
synced 2024-12-26 17:19:06 -05:00
fix DenoBlob name (#5879)
This commit is contained in:
parent
55311c33c4
commit
fe7d6824c9
2 changed files with 14 additions and 1 deletions
|
@ -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 };
|
||||
|
|
|
@ -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");
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue