source: trip-planner-front/node_modules/batch/Readme.md@ 8d391a1

Last change on this file since 8d391a1 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 731 bytes
Line 
1
2# batch
3
4 Simple async batch with concurrency control and progress reporting.
5
6## Installation
7
8```
9$ npm install batch
10```
11
12## API
13
14```js
15var Batch = require('batch')
16 , batch = new Batch;
17
18batch.concurrency(4);
19
20ids.forEach(function(id){
21 batch.push(function(done){
22 User.get(id, done);
23 });
24});
25
26batch.on('progress', function(e){
27
28});
29
30batch.end(function(err, users){
31
32});
33```
34
35### Progress events
36
37 Contain the "job" index, response value, duration information, and completion data.
38
39```
40{ index: 1,
41 value: 'bar',
42 pending: 2,
43 total: 3,
44 complete: 2,
45 percent: 66,
46 start: Thu Oct 04 2012 12:25:53 GMT-0700 (PDT),
47 end: Thu Oct 04 2012 12:25:53 GMT-0700 (PDT),
48 duration: 0 }
49```
50
51## License
52
53[MIT](LICENSE)
Note: See TracBrowser for help on using the repository browser.