Skip to content

Commit 73328c7

Browse files
committed
2
1 parent 8e1c324 commit 73328c7

File tree

3 files changed

+45
-10
lines changed

3 files changed

+45
-10
lines changed

1.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# 维护下载数据
2+
3+
下载数据包括
4+
1. task
5+
2. task中的fileList
6+
3. fileList每个item的属性,状态
7+
8+
# 任务在哪里处理
9+
10+
特性:
11+
1. 任务启动后与页面无关,后台执行
12+
2. 登录后需要检查任务,并判断是否执行
13+
14+
# 主流程
15+
16+
1.

1.ts

-10
This file was deleted.

async/promise.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Promise
2+
3+
## 创建Promise
4+
5+
```js
6+
const a = new Promise((resolve, reject) => {
7+
// 执行异步任务
8+
if (a) {
9+
resolve(1)
10+
} else (
11+
reject(1)
12+
)
13+
})
14+
```
15+
16+
## resolve & reject
17+
18+
resolve: 表示调用成功
19+
20+
## then(success, fail)
21+
22+
当调用`then``promise`成功,执行了`resolve`,函数就会走到这里的`success`
23+
24+
当执行了`reject`,或者抛出了异常,函数就会走到这里的`fail`
25+
26+
## catch(e => void)
27+
catch(failureCallback) 是 then(null, failureCallback)的缩写
28+
29+
通常用于在链式调用的最后捕捉异常

0 commit comments

Comments
 (0)