Skip to content

Commit 984e03a

Browse files
committed
README Changes
1 parent d827ca8 commit 984e03a

File tree

1 file changed

+27
-25
lines changed

1 file changed

+27
-25
lines changed

README.md

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ In package.json
9191

9292
```javascript
9393

94-
"async-methods":"^0.2.15"
94+
"async-methods":"^1.0.1"
9595

9696
```
9797

@@ -139,6 +139,32 @@ at the end of the chain (see examples below). That way errors will be trapped a
139139

140140
## Wrapping
141141

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+
142168
### Wrap ES6 Class with methods
143169

144170
#### am( methodName , class { methodName { ... }}, args ...)
@@ -255,31 +281,7 @@ Create *ExtendedPromise* that returns an array.
255281

256282
```
257283

258-
### Wrap async function
259-
260-
#### am(async fn)
261-
262-
Creates *ExtendedPromise*
263-
264284

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-
```
283285

284286
##### Evaluate arrays and objects of async functions (or other types of asynchronous oeprations)
285287

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy