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:
@@ -297,8 +297,8 @@ export default Vue.extend({
|
||||
let flag = false;
|
||||
const complete = () => {
|
||||
if (flag) {
|
||||
fetchedFolders.forEach(this.appendFolder);
|
||||
fetchedFiles.forEach(this.appendFile);
|
||||
for (const x of fetchedFolders) this.appendFolder(x);
|
||||
for (const x of fetchedFiles) this.appendFile(x);
|
||||
this.fetching = false;
|
||||
|
||||
// 一連の読み込みが完了したイベントを発行
|
||||
@@ -336,7 +336,7 @@ export default Vue.extend({
|
||||
} else {
|
||||
this.moreFiles = false;
|
||||
}
|
||||
files.forEach(this.appendFile);
|
||||
for (const x of files) this.appendFile(x);
|
||||
this.fetching = false;
|
||||
this.fetchingMoreFiles = false;
|
||||
});
|
||||
@@ -460,8 +460,9 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
onChangeLocalFile() {
|
||||
Array.from((this.$refs.file as any).files)
|
||||
.forEach(f => (this.$refs.uploader as any).upload(f, this.folder));
|
||||
for (const f of Array.from((this.$refs.file as any).files)) {
|
||||
(this.$refs.uploader as any).upload(f, this.folder);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@@ -149,7 +149,9 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
releaseQueue() {
|
||||
this.queue.forEach(n => this.prepend(n, true));
|
||||
for (const n of this.queue) {
|
||||
this.prepend(n, true);
|
||||
}
|
||||
this.queue = [];
|
||||
},
|
||||
|
||||
|
@@ -174,7 +174,7 @@ export default Vue.extend({
|
||||
if (this.reply && this.reply.text != null) {
|
||||
const ast = parse(this.reply.text);
|
||||
|
||||
ast.filter(t => t.type == 'mention').forEach(x => {
|
||||
for (const x of ast.filter(t => t.type == 'mention')) {
|
||||
const mention = x.host ? `@${x.username}@${toASCII(x.host)}` : `@${x.username}`;
|
||||
|
||||
// 自分は除外
|
||||
@@ -185,7 +185,7 @@ export default Vue.extend({
|
||||
if (this.text.indexOf(`${mention} `) != -1) return;
|
||||
|
||||
this.text += `${mention} `;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// デフォルト公開範囲
|
||||
@@ -241,7 +241,7 @@ export default Vue.extend({
|
||||
this.$chooseDriveFile({
|
||||
multiple: true
|
||||
}).then(files => {
|
||||
files.forEach(this.attachMedia);
|
||||
for (const x of files) this.attachMedia(x);
|
||||
});
|
||||
},
|
||||
|
||||
@@ -256,7 +256,7 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
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);
|
||||
},
|
||||
|
||||
onPollUpdate() {
|
||||
|
@@ -94,7 +94,9 @@ export default Vue.extend({
|
||||
} else {
|
||||
this.existMore = false;
|
||||
}
|
||||
notes.forEach(n => (this.$refs.timeline as any).append(n));
|
||||
for (const n of notes) {
|
||||
(this.$refs.timeline as any).append(n);
|
||||
}
|
||||
this.moreFetching = false;
|
||||
});
|
||||
|
||||
|
@@ -76,7 +76,9 @@ export default Vue.extend({
|
||||
} else {
|
||||
this.existMore = false;
|
||||
}
|
||||
notes.forEach(n => (this.$refs.timeline as any).append(n));
|
||||
for (const n of notes) {
|
||||
(this.$refs.timeline as any).append(n);
|
||||
}
|
||||
this.moreFetching = false;
|
||||
});
|
||||
|
||||
|
@@ -150,7 +150,9 @@ export default Vue.extend({
|
||||
} else {
|
||||
this.existMore = false;
|
||||
}
|
||||
notes.forEach(n => (this.$refs.timeline as any).append(n));
|
||||
for (const n of notes) {
|
||||
(this.$refs.timeline as any).append(n);
|
||||
}
|
||||
this.moreFetching = false;
|
||||
});
|
||||
|
||||
|
@@ -77,7 +77,9 @@ export default Vue.extend({
|
||||
} else {
|
||||
this.existMore = false;
|
||||
}
|
||||
notes.forEach(n => (this.$refs.timeline as any).append(n));
|
||||
for (const n of notes) {
|
||||
(this.$refs.timeline as any).append(n);
|
||||
}
|
||||
this.moreFetching = false;
|
||||
});
|
||||
|
||||
|
@@ -72,7 +72,9 @@ export default Vue.extend({
|
||||
} else {
|
||||
this.existMore = false;
|
||||
}
|
||||
notes.forEach(n => (this.$refs.timeline as any).append(n));
|
||||
for (const n of notes) {
|
||||
(this.$refs.timeline as any).append(n);
|
||||
}
|
||||
this.moreFetching = false;
|
||||
});
|
||||
|
||||
|
@@ -32,14 +32,16 @@ export default Vue.extend({
|
||||
limit: 6,
|
||||
untilDate: new Date().getTime() + 1000 * 86400 * 365
|
||||
}).then(notes => {
|
||||
notes.forEach(note => {
|
||||
note.media.forEach(media => {
|
||||
if (this.images.length < 9) this.images.push({
|
||||
note,
|
||||
media
|
||||
});
|
||||
});
|
||||
});
|
||||
for (const note of notes) {
|
||||
for (const media of note.media) {
|
||||
if (this.images.length < 9) {
|
||||
this.images.push({
|
||||
note,
|
||||
media
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
this.fetching = false;
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user