happy-dom
Advanced tools
Comparing version 13.8.0 to 13.8.1
@@ -19,3 +19,3 @@ import Blob from '../file/Blob.cjs'; | ||
constructor(data: { | ||
[mimeType: string]: Blob; | ||
[mimeType: string]: Blob | string | Promise<Blob | string>; | ||
}, options?: { | ||
@@ -36,4 +36,4 @@ presentationStyle?: 'unspecified' | 'inline' | 'attachment'; | ||
*/ | ||
getType(type: string): Promise<Blob>; | ||
getType(type: string): Promise<Blob | string>; | ||
} | ||
//# sourceMappingURL=ClipboardItem.d.ts.map |
@@ -62,3 +62,10 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { | ||
if (item.types.includes('text/plain')) { | ||
text += await (await item.getType('text/plain')).text(); | ||
const data = await item.getType('text/plain'); | ||
if (typeof data === 'string') { | ||
text += data; | ||
} | ||
else { | ||
// Instance of Blob | ||
text += await data.text(); | ||
} | ||
} | ||
@@ -65,0 +72,0 @@ } |
@@ -19,3 +19,3 @@ import Blob from '../file/Blob.js'; | ||
constructor(data: { | ||
[mimeType: string]: Blob; | ||
[mimeType: string]: Blob | string | Promise<Blob | string>; | ||
}, options?: { | ||
@@ -36,4 +36,4 @@ presentationStyle?: 'unspecified' | 'inline' | 'attachment'; | ||
*/ | ||
getType(type: string): Promise<Blob>; | ||
getType(type: string): Promise<Blob | string>; | ||
} | ||
//# sourceMappingURL=ClipboardItem.d.ts.map |
@@ -31,7 +31,2 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { | ||
_ClipboardItem_data.set(this, void 0); | ||
for (const mimeType of Object.keys(data)) { | ||
if (mimeType !== data[mimeType].type) { | ||
throw new DOMException(`Type ${mimeType} does not match the blob's type`); | ||
} | ||
} | ||
__classPrivateFieldSet(this, _ClipboardItem_data, data, "f"); | ||
@@ -38,0 +33,0 @@ if (options?.presentationStyle) { |
@@ -1,1 +0,1 @@ | ||
export default { version: '13.8.0' }; | ||
export default { version: '13.8.1' }; |
{ | ||
"name": "happy-dom", | ||
"version": "13.8.0", | ||
"version": "13.8.1", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/capricorn86/happy-dom", |
@@ -57,3 +57,9 @@ import DOMException from '../exception/DOMException.js'; | ||
if (item.types.includes('text/plain')) { | ||
text += await (await item.getType('text/plain')).text(); | ||
const data = await item.getType('text/plain'); | ||
if (typeof data === 'string') { | ||
text += data; | ||
} else { | ||
// Instance of Blob | ||
text += await data.text(); | ||
} | ||
} | ||
@@ -60,0 +66,0 @@ } |
@@ -12,3 +12,3 @@ import DOMException from '../exception/DOMException.js'; | ||
public readonly presentationStyle: 'unspecified' | 'inline' | 'attachment' = 'unspecified'; | ||
#data: { [mimeType: string]: Blob }; | ||
#data: { [mimeType: string]: Blob | string | Promise<Blob | string> }; | ||
@@ -23,10 +23,5 @@ /** | ||
constructor( | ||
data: { [mimeType: string]: Blob }, | ||
data: { [mimeType: string]: Blob | string | Promise<Blob | string> }, | ||
options?: { presentationStyle?: 'unspecified' | 'inline' | 'attachment' } | ||
) { | ||
for (const mimeType of Object.keys(data)) { | ||
if (mimeType !== data[mimeType].type) { | ||
throw new DOMException(`Type ${mimeType} does not match the blob's type`); | ||
} | ||
} | ||
this.#data = data; | ||
@@ -53,3 +48,3 @@ if (options?.presentationStyle) { | ||
*/ | ||
public async getType(type: string): Promise<Blob> { | ||
public async getType(type: string): Promise<Blob | string> { | ||
if (!this.#data[type]) { | ||
@@ -56,0 +51,0 @@ throw new DOMException( |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8627550
171553