mirror of
https://github.com/fooflington/selfdefined.git
synced 2025-04-21 16:59:08 +00:00
38 lines
437 B
Markdown
38 lines
437 B
Markdown
![]() |
# traverse-chain
|
||
|
|
||
|
A simple asynchronous tool
|
||
|
|
||
|
## Installation
|
||
|
|
||
|
```bash
|
||
|
$ npm install traverse-chain
|
||
|
```
|
||
|
|
||
|
## Example
|
||
|
|
||
|
```javascript
|
||
|
|
||
|
var Chain = require('traverse-chain');
|
||
|
var chain = new Chain();
|
||
|
|
||
|
chain.add(
|
||
|
function() {
|
||
|
setTimeout(function() {
|
||
|
chain.next();
|
||
|
}, 2000);
|
||
|
},
|
||
|
functin() {
|
||
|
setTimeout(function() {
|
||
|
chain.next();
|
||
|
}, 1000);
|
||
|
}
|
||
|
)
|
||
|
|
||
|
chain.traverse(function() {
|
||
|
// done
|
||
|
});
|
||
|
```
|
||
|
|
||
|
## License
|
||
|
MIT
|