Add thisArg to DataTransfer.forEach (#151658)

Fixes #151657

All of our other `forEach` functions take a `this` arg which is used when invoking the callback. This just aligns `DataTransfer.forEach`
This commit is contained in:
Matt Bierner
2022-06-09 15:55:54 -07:00
committed by GitHub
parent cb2d3caec1
commit b331f811c1
2 changed files with 5 additions and 3 deletions
+2 -2
View File
@@ -2473,9 +2473,9 @@ export class DataTransfer {
this.#items.set(mimeType, [value]);
}
forEach(callbackfn: (value: DataTransferItem, key: string) => void): void {
forEach(callbackfn: (value: DataTransferItem, key: string) => void, thisArg?: unknown): void {
for (const [mime, items] of this.#items) {
items.forEach(item => callbackfn(item, mime));
items.forEach(item => callbackfn(item, mime), thisArg);
}
}
}
+3 -1
View File
@@ -10110,9 +10110,11 @@ declare module 'vscode' {
/**
* Allows iteration through the data transfer items.
*
* @param callbackfn Callback for iteration through the data transfer items.
* @param thisArg The `this` context used when invoking the handler function.
*/
forEach(callbackfn: (value: DataTransferItem, key: string) => void): void;
forEach(callbackfn: (value: DataTransferItem, key: string) => void, thisArg?: unknown): void;
}
/**