File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ function success ( x ) {
2
+ console . log ( 'success' , x . data )
3
+ }
4
+
5
+ function error ( err ) {
6
+ console . log ( 'err' , err . data )
7
+ }
8
+
9
+ // function handleResolve(resolve){
10
+
11
+ // }
12
+
13
+ // ajax -> XMLHttpRequest, fetch
14
+ const laundryPromise = new Promise ( resolve => {
15
+ resolve ( { data : "Take out laundry" } )
16
+
17
+ //throw ({data: "This is an error. I forgot"})
18
+
19
+ } ) // built-in class
20
+
21
+ // console.log(laundryPromise)
22
+
23
+ // laundryPromise.then(success).catch(error)
24
+
25
+ // console.log("When does this run??")
26
+
27
+ async function helloThere ( ) {
28
+ const result = await laundryPromise . catch ( x => {
29
+ throw ( x )
30
+ } )
31
+ // return result
32
+ }
33
+
34
+ helloThere ( ) . then ( x => {
35
+ console . log ( x )
36
+ } ) . catch ( x => {
37
+ console . log ( 'err' , x )
38
+ } )
39
+ // console.log(result)
You can’t perform that action at this time.
0 commit comments