Use for-of instead of forEach (#3583)

Co-authored-by: syuilo <syuilotan@yahoo.co.jp>
Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com>
This commit is contained in:
Aya Morisawa 2018-12-11 20:36:55 +09:00 committed by GitHub
parent 30c53e9ee0
commit 125849673a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
84 changed files with 345 additions and 283 deletions

View file

@ -99,7 +99,7 @@ export default define({
this.$chooseDriveFile({
multiple: true
}).then(files => {
files.forEach(this.attachMedia);
for (const x of files) this.attachMedia(x);
});
},
@ -118,15 +118,15 @@ export default define({
},
onPaste(e) {
Array.from(e.clipboardData.items).forEach((item: any) => {
for (const item of Array.from(e.clipboardData.items)) {
if (item.kind == 'file') {
this.upload(item.getAsFile());
}
});
}
},
onChangeFile() {
Array.from((this.$refs.file as any).files).forEach(this.upload);
for (const x of Array.from((this.$refs.file as any).files)) this.upload(x);
},
upload(file) {
@ -146,7 +146,7 @@ export default define({
//
if (e.dataTransfer.files.length > 0) {
e.preventDefault();
Array.from(e.dataTransfer.files).forEach(this.upload);
for (const x of Array.from(e.dataTransfer.files)) this.upload(x);
return;
}