当前位置:网站首页>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()
})
边栏推荐
猜你喜欢

2021-10-04

Basic usage of mock server

07 data import sqoop

Pytest-- test report allure configuration

【避坑指南】使用UGUI遇到的坑:Text组件无法首行缩进两格

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

4.随机变量

Mongodb quickly get started with some simple operations of mongodb command line

Leetcode -- the nearest common ancestor of 236 binary tree

2021-10-02
随机推荐
Flink submitter
Network communication learning
【leetcode】33. Search rotation sort array
What is the significance of the college entrance examination
2021-10-04
SUS系统可用性量表
【教程】如何让VisualStudio的HelpViewer帮助文档独立运行
判断数组中是否存在重复元素
stm32和电机开发(上位系统)
12.进程同步与信号量
webUI自动化学习
Webui automated learning
【JetBrain Rider】构建项目出现异常:未找到导入的项目“D:\VisualStudio2017\IDE\MSBuild\15.0\Bin\Roslyn\Microsoft.CSh
Message mechanism -- getting to know messages and message queues for the first time
flume 190 INSTALL
【避坑指南】使用UGUI遇到的坑:Text组件无法首行缩进两格
js promise.all
Database dictionary Navicat automatic generation version
Blender模型导入ue、碰撞设置
Introduction and Principle notes of UE4 material