当前位置:网站首页>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()
})
边栏推荐
猜你喜欢
Shutter - canvas custom graph
Pytest learning --base
Understand the composition of building energy-saving system
Basic notes of illusory AI blueprint (10000 words)
01安装虚拟机
pytest框架实现前后置
Is this code PHP MySQL redundant?
Blender模型导入ue、碰撞设置
stm32和電機開發(上比特系統)
Beautiful and intelligent, Haval H6 supreme+ makes Yuanxiao travel safer
随机推荐
sqoop创建job出现的一系列问题解决方法
Rapid prototyping
flink 提交程序
ERROR 1118 (42000): Row size too large (> 8126)
[visual studio] every time you open a script of unity3d, a new vs2017 will be automatically reopened
SQOOP 1.4.6 INSTALL
07数据导入Sqoop
[unity3d] production progress bar - make image have the functions of filled and sliced at the same time
2021-10-02
Redis set password
快速做出原型
Post disaster reconstruction -- Floyd thought
session-cookie与token
Unreal material editor foundation - how to connect a basic material
Nonlinear optimization: establishment of slam model
flume 190 INSTALL
Ctrip starts mixed office. How can small and medium-sized enterprises achieve mixed office?
Is this code PHP MySQL redundant?
高考的意义是什么
ue4材质的入门和原理笔记