This commit is contained in:
Dmitry Vasilev
2022-12-07 05:06:15 +08:00
parent 9e9400ab24
commit 707c34bc66
8 changed files with 178 additions and 49 deletions

20
x.js
View File

@@ -1,17 +1,31 @@
/*
const delay = new Promise(resolve => {
const delay = () => new Promise(resolve => {
setTimeout(resolve, 1000)
})
await [1,2,3,4,5].reduce(
async (acc, x) => {
console.log('wait')
await acc
await delay()
console.log('wait finish')
},
Promise.resolve(),
)
/*
await delay
console.log('x')
export const x = 1
*/
/*
const p = {then: y => y(3)}
async function test() {
return await p
}
*/
// TODO remove
//const x = new Promise((resolve, reject) => resolve(10))
@@ -26,4 +40,4 @@ async function test() {
//x.then(() => {
// console.log('x', x.status)
//})
console.log(await test())
//console.log(await test())