1
1
下面介绍如何通过创建累加器对象向下传递值,然后在每个步骤中添加result属性,从而将值向下传递承诺链:
大致相当于:
以防此语法混淆。 |
2
0
在放入“then”的回调中,不需要调用resolve()来调用链的下一步。您只需要返回一些值,链的下一步将接收它作为参数。 您可能混淆了承诺的创建和链接方式。创建承诺时,向其构造函数提供回调,其参数为“resolve”和“reject”,它们也是回调。它们预期将由promise构造函数中回调内的代码调用。调用resolve时,承诺将使用您提供的值进行解析。拒绝也一样。
|
AlaaKudo810 · 无法更新猫鼬中的对象 1 年前 |
Foobar · 如何在Fastify中为请求附加“项目”密钥? 1 年前 |
chrispytoes · 从服务器端获取登录用户 1 年前 |