我试图围绕以下示例中发生的事情绞尽脑汁:
class Project {
async foo(input) {
for (let barOutput on this.bar(input)) {
// what happens on the following line?
return barOutput.id;
}
}
async *bar(input) {
yield {
id: input.id,
title: "Test"
};
}
}
new Project().foo()
.then(result => {
console.log(result);
});
return
循环中的for...of
语句是否取消订阅代表Project#bar
输出的观察者?