You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
427 B
Markdown
30 lines
427 B
Markdown
|
1 month ago
|
# all
|
||
|
|
|
||
|
|
callback when all callbacks have fired.
|
||
|
|
|
||
|
|
<img src=https://secure.travis-ci.org/dominictarr/all.png?branch=master>
|
||
|
|
|
||
|
|
``` js
|
||
|
|
var all = require('all')
|
||
|
|
var after = all(function () {
|
||
|
|
console.log('done')
|
||
|
|
})
|
||
|
|
|
||
|
|
function doSomething(n, cb) {
|
||
|
|
setTimeout(function () {
|
||
|
|
console.log('N', n)
|
||
|
|
}, Math.random() * 100)
|
||
|
|
}
|
||
|
|
|
||
|
|
doSomething(1, cb())
|
||
|
|
doSomething(2, cb())
|
||
|
|
doSomething(3, cb())
|
||
|
|
doSomething(4, cb())
|
||
|
|
|
||
|
|
```
|
||
|
|
|
||
|
|
|
||
|
|
## License
|
||
|
|
|
||
|
|
MIT
|