当前位置:网站首页>Scénarios d'utilisation de la promesse
Scénarios d'utilisation de la promesse
2022-06-24 08:23:00 【Nanjing Front End】
1.await && async Mot - clé en attente de la demande
async function test(){
var message = await new Promise((resolve,reject)=>{
setTimeout(function(){
resolve("{message:'hello'}")
},3000)
})
.then(value=>{ return JSON.parse(value) })
.then(value=>{
return value
})
console.log(message)
}2.Demande étape par étape
var message = new Promise((resolve,reject)=>{
//Demande de validation avant demande formelle
setTimeout(function(){
resolve('success')
},3000)
}).then(value=>{
if(value=='success'){//Authentification réussie
return new Promise((resolve,reject)=>{
setTimeout(function(){
resolve({username:'xx'})
},3000)
})
}
})
message.then(res=>{
console.log(res.username)
})边栏推荐
- 权限模型 DAC ACL RBAC ABAC
- Review SGI STL secondary space configurator (internal storage pool) | notes for personal use
- 2022 mobile crane driver special operation certificate examination question bank and online simulation examination
- pyQt 中 QMenu 响应
- [introduction to point cloud dataset]
- Swift 基础 Swift才有的特性
- 问题3 — messageBox弹框,修改默认背景色
- 新准则金融资产三分类:AMC、FVOCI和FVTPL
- Future trends in automated testing
- Swift foundation features unique to swift
猜你喜欢

OC Extension 检测手机是否安装某个App(源码)

直播回顾 | 云原生混部系统 Koordinator 架构详解(附完整PPT)

2021-03-16 COMP9021第九节课笔记

Utilisation de la fermeture / bloc de base SWIFT (source)

2021-03-04 comp9021 class 6 notes
![3D数学基础[十七] 平方反比定理](/img/59/bef931d96883288766fc94e38e0ace.png)
3D数学基础[十七] 平方反比定理
![[008] filter the table data row by row, jump out of the for cycle and skip this cycle VBA](/img/a0/f03b8d9c8f5e53078c38cce11f8ad3.png)
[008] filter the table data row by row, jump out of the for cycle and skip this cycle VBA

小样本故障诊断 - 注意力机制代码 - BiGRU代码解析实现

根据网络上的视频的m3u8文件通过ffmpeg进行合成视频

WCF TCP protocol transmission
随机推荐
LINQ query (2)
Phonics
The article takes you to understand the security of Windows operating system and protect your computer from infringement
Utilisation de la fermeture / bloc de base SWIFT (source)
Sql语句内运算问题
The first exposure of Alibaba cloud's native security panorama behind the only highest level in the whole domain
Tool functions – get all files in the project folder
【点云数据集介绍】
Four models of iPhone 13 series have been exposed, and indeed, they are 13 fragrant!
C# Lambda
Small sample fault diagnosis - attention mechanism code - Implementation of bigru code parsing
Swift 基础 闭包/Block的使用(源码)
You get in Anaconda
新技术实战,一步步用Activity Results API封装权限申请库
jwt(json web token)
11-- longest substring without repeated characters
将mysql的数据库导出xxx.sql,将xxx.sql文件导入到服务器的mysql中。项目部署。
Atguigu---15- built in instruction
自动化测试的未来趋势
For a detailed explanation of flex:1, flex:1