我无法掌握如何获得正确的价值。解决我的问题。
因此,例如,我有时会得到不包含两个相同人的客户列表。然后对于他们每个人,我想添加另一个承诺,我传递每个人的名字。问题是有时我得到两个称为“Foo”和“Foo”的,而不是“Foo”和“Bar”。
(...)
for (let client in clients) {
chain = chain.then(resolve => mainEvent(clients[client])) // since this is built and executed after, I sometimes get repeating client names. It's really unpredictable and weird.
ev.client.chat(clients[client].name()) // correct output but this is in sync with the loop
}
(...)