File tree Expand file tree Collapse file tree 1 file changed +27
-25
lines changed Expand file tree Collapse file tree 1 file changed +27
-25
lines changed Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ In package.json
91
91
92
92
``` javascript
93
93
94
- " async-methods" : " ^0.2.15 "
94
+ " async-methods" : " ^1.0.1 "
95
95
96
96
```
97
97
@@ -139,6 +139,32 @@ at the end of the chain (see examples below). That way errors will be trapped a
139
139
140
140
## Wrapping
141
141
142
+ ### Wrap async function
143
+
144
+ #### am(async fn)
145
+
146
+ Creates * ExtendedPromise*
147
+
148
+
149
+ ``` javascript
150
+
151
+
152
+ am (async function (arg ) {
153
+ return await Promise .resolve ({ a: 23864 - arg })
154
+ },4 ) // any extra arguments are applied to function
155
+ .then (r => {
156
+ console .log (r) // { a: 23860 })
157
+
158
+ })
159
+ .error (err => {
160
+ // handle error at end of chain
161
+ console .log (err)
162
+
163
+ })
164
+
165
+
166
+ ```
167
+
142
168
### Wrap ES6 Class with methods
143
169
144
170
#### am( methodName , class { methodName { ... }}, args ...)
@@ -255,31 +281,7 @@ Create *ExtendedPromise* that returns an array.
255
281
256
282
```
257
283
258
- ### Wrap async function
259
-
260
- #### am(async fn)
261
-
262
- Creates * ExtendedPromise*
263
-
264
284
265
- ``` javascript
266
-
267
-
268
- am (async function (arg ) {
269
- return await Promise .resolve ({ a: 23864 - arg })
270
- },4 ) // any extra arguments are applied to function
271
- .then (r => {
272
- console .log (r) // { a: 23860 })
273
-
274
- })
275
- .error (err => {
276
- // handle error at end of chain
277
- console .log (err)
278
-
279
- })
280
-
281
-
282
- ```
283
285
284
286
##### Evaluate arrays and objects of async functions (or other types of asynchronous oeprations)
285
287
You can’t perform that action at this time.
0 commit comments