当前位置:网站首页>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()
})
边栏推荐
- MPLS experiment
- Blender stone carving
- 【Unity3D】无法正确获取RectTransform的属性值导致计算出错
- STM32 and motor development (upper system)
- ue4材质的入门和原理笔记
- Stm32 et développement de moteurs (système supérieur)
- [pit avoidance guide] pit encountered using ugui: the text component cannot indent the first line by two spaces
- [tutorial] how to make the Helpviewer help document of VisualStudio run independently
- 【JetBrain Rider】构建项目出现异常:未找到导入的项目“D:\VisualStudio2017\IDE\MSBuild\15.0\Bin\Roslyn\Microsoft.CSh
- Pywin32打开指定窗口
猜你喜欢

07 data import sqoop

Redis set password

AutoCAD - layer Linetype

This article takes you to learn in detail what is fiber to home FTTH

Is this code PHP MySQL redundant?

How to get the password of cpolar?

测试--面试题总结

Edge computing accelerates live video scenes: clearer, smoother, and more real-time

Flutter——Canvas自定义曲线图

Following nym, the new project Galaxy token announced by coinlist is gal
随机推荐
Mongodb quickly get started with some simple operations of mongodb command line
[unity3d] nested use layout group to make scroll view with dynamic sub object height
Considerations for Apache deploying static web page projects
4.随机变量
Retrofit's callback hell is really vulnerable in kotlin synergy mode!
Flink submitter
《MySQL 8 DBA基础教程》简介
Unreal material editor foundation - how to connect a basic material
测试--面试题总结
02-taildir source
拆解美图SaaS:开着飞机换引擎
Leetcode -- the nearest common ancestor of 236 binary tree
Blender model import UE, collision settings
Aiphacode is not a substitute for programmers, but a tool for developers
flume 190 INSTALL
2021-10-02
【避坑指南】Unity3D项目接入腾讯Bugly工具时遇到的坑
【JetBrain Rider】构建项目出现异常:未找到导入的项目“D:\VisualStudio2017\IDE\MSBuild\15.0\Bin\Roslyn\Microsoft.CSh
使用Windbg静态分析dump文件(实战经验总结)
【教程】如何让VisualStudio的HelpViewer帮助文档独立运行