We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e83129a commit 52adb3aCopy full SHA for 52adb3a
09/promise.md
@@ -1,2 +1,35 @@
1
+---
2
+description: Promise 使用
3
4
+
5
# Promise
6
7
+## Promise简介
8
9
+Promise 对象用于表示一个异步操作的最终完成(或失败)及其结果值
10
11
+```javascript
12
+const myFirstPromise = new Promise((resolve, reject) => {
13
+ // ?做一些异步操作,最终会调用下面两者之一:
14
+ //
15
+ // resolve(someValue); // fulfilled
16
+ // ?或
17
+ // reject("failure reason"); // rejected
18
+});
19
+```
20
21
+{% hint style="info" %}
22
+ promise.finally\(\) 要注意浏览器兼容性
23
+{% endhint %}
24
25
+## Promise原型
26
27
+{% code title="hello.sh" %}
28
+```bash
29
+# Ain't no code for that yet, sorry
30
+echo 'You got to trust me on this, I saved the world'
31
32
+{% endcode %}
33
34
35
0 commit comments