Skip to content

Commit d604294

Browse files
committed
Added the README for automatic this in compiled mode.
1 parent cd6d68d commit d604294

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

README.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ fall(that, [
100100
### Compile a waterfall
101101

102102
```js
103-
var fall = require('./')([
103+
var fall = require('fastfall')([
104104
function a (arg, cb) {
105105
console.log('called a')
106106
cb(null, arg)
@@ -124,7 +124,7 @@ You can set `this` by doing:
124124

125125
```js
126126
var that = { hello: 'world' }
127-
var fall = require('./')(that, [
127+
var fall = require('fastfall')(that, [
128128
function a (arg, cb) {
129129
console.log('this is', this)
130130
console.log('called a')
@@ -145,6 +145,32 @@ fall(42, function result (err, a, b, c) {
145145
})
146146
```
147147

148+
or you can simply attach it to an object:
149+
150+
```js
151+
var that = { hello: 'world' }
152+
that.doSomething = require('fastfall')([
153+
function a (arg, cb) {
154+
console.log('this is', this)
155+
console.log('called a')
156+
cb(null, arg)
157+
},
158+
function b (a, cb) {
159+
console.log('called b with:', a)
160+
cb(null, 'a', 'b')
161+
},
162+
function c (a, b, cb) {
163+
console.log('called c with:', a, b)
164+
cb(null, 'a', 'b', 'c')
165+
}])
166+
167+
// a compiled fall supports arguments too!
168+
that.doSomething(42, function result (err, a, b, c) {
169+
console.log('this is', this)
170+
console.log('result arguments', arguments)
171+
})
172+
```
173+
148174
## License
149175

150176
ISC

0 commit comments

Comments
 (0)