javascript - bluebird.js 等待 Promise.all(); 在处理程序警告中创建了一个承诺
问题描述
async-await
我希望同时开始的多个承诺的正确方法是什么。我在做await Promise.all(...)
,但是...
我收到一个烦人的警告:
Warning: a promise was created in a handler at (path) but was not returned from it
at new Promise (path)
at MyComponent.<anonymous> (path)
at MyComponent.componentDidMount (path)
async componentDidMount() {
await this.fetchAB();
}
async fetchAB() {
const [a, b] = await Promise.all([
new Promise(function pA(r) { return r('a') }),
new Promise(function pB(r) { return r('b') }),
]);
console.log(a, b);
}
使用 bluebird 覆盖承诺3.7.2
(最近的)。通天塔/核心7.5.4
我已经尽一切努力使警告静音,它非常嘈杂,并且导致控制台加载非常缓慢。即将禁用它BLUEBIRD_W_FORGOTTEN_RETURN
...
解决方案
推荐阅读
- azure - 用于特定权限集的 Blob 存储的 Azure 角色
- react-native - 从 NativeBase v2 迁移到 v3 时出现问题
- java - FreeMarker 如何将变量传递给另一个变量?
- listview - ListView中如何控制编辑控件的位置
- c# - C# 不可调用成员“ProdhimiQumështit.DataTabel”不能像方法一样使用
- cypress - cypress-cucumber - 将值从一步定义传递到另一步定义
- c# - .net 核心中间件创建中 next(context) 与 await next.Invoke(context) 之间的区别
- c# - 向数组添加元素有效,但未显示在其他 switch 语句中
- html - Knockout js:有条件地绑定title属性
- javascript - 如何在 Vuejs 嵌套条件语句中选中一个框