当前位置:网站首页>js promise. all
js promise. all
2022-07-02 10:40:00 【Big chicken legs are best】
let d= promise.all([a,b,c])
Accept one promise Array , Only those in the array promise Success returns only after all success , Or fail
Only a、b、c The state of fulfilled,d The state of fulfilled, here a、b、c The return value of consists of an array , Pass to d Callback function for .
as long as a、b、c One of them was rejected,d The state of rejected, At this time, the first was reject The return value of the instance of , Will pass to p Callback function for .
Interview questions
function c In function a and b Only after the execution
Just use promise.all
let a=function(){
console.log('a')
}
let b=function(){
console.log('b')
}
let p1 = new Promise((resolve, reject) => {
a()
resolve(' succeed ')
})
let p2 = new Promise((resolve, reject) => {
b()
resolve('success')
})
let c=function(){
console.log('c')
}
Promise.all([p1, p2]).then((result) => {
c()
})
边栏推荐
- 02-taildir source
- 【避坑指南】Unity3D项目接入腾讯Bugly工具时遇到的坑
- [pit avoidance guide] pit encountered by unity3d project when accessing Tencent bugly tool
- sqoop创建job出现的一系列问题解决方法
- webUI自动化学习
- How to achieve the top progress bar effect in background management projects
- session-cookie与token
- [IDL] Research
- Use WinDbg to statically analyze dump files (summary of practical experience)
- Following nym, the new project Galaxy token announced by coinlist is gal
猜你喜欢

测试--面试题总结

Beautiful and intelligent, Haval H6 supreme+ makes Yuanxiao travel safer

Flutter——Canvas自定义曲线图

Feature (5): how to organize information

Blender volume fog

Application of rxjs operator withlatestfrom in Spartacus UI of SAP e-commerce cloud

Vscode set JSON file to format automatically after saving

对话吴纲:我为什么笃信“大国品牌”的崛起?

判断数组中是否存在重复元素

Blender石头雕刻
随机推荐
Nonlinear optimization: steepest descent method, Newton method, Gauss Newton method, Levenberg Marquardt method
Windows环境MySQL8忘记密码文件解决方案
MYSQL关键字
Message mechanism -- getting to know messages and message queues for the first time
2021-10-02
Beautiful and intelligent, Haval H6 supreme+ makes Yuanxiao travel safer
Sus system availability scale
Post disaster reconstruction -- Floyd thought
Leetcode -- the nearest common ancestor of 236 binary tree
[visual studio] every time you open a script of unity3d, a new vs2017 will be automatically reopened
Considerations for Apache deploying static web page projects
Flutter——Canvas自定义曲线图
Notes de base sur les plans illusoires d'IA (triés en 10 000 mots)
Application of rxjs operator withlatestfrom in Spartacus UI of SAP e-commerce cloud
Blender ocean production
Importing tables from sqoop
【Visual Studio】每次打开一个Unity3D的脚本,都会自动重新打开一个新的VS2017
Pytest-- test report allure configuration
Postman--使用
The nanny level tutorial of flutter environment configuration makes the doctor green to the end