main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
533 bytes
|
Line | |
---|
1 | var abort = require('./abort.js')
|
---|
2 | , async = require('./async.js')
|
---|
3 | ;
|
---|
4 |
|
---|
5 | // API
|
---|
6 | module.exports = terminator;
|
---|
7 |
|
---|
8 | /**
|
---|
9 | * Terminates jobs in the attached state context
|
---|
10 | *
|
---|
11 | * @this AsyncKitState#
|
---|
12 | * @param {function} callback - final callback to invoke after termination
|
---|
13 | */
|
---|
14 | function terminator(callback)
|
---|
15 | {
|
---|
16 | if (!Object.keys(this.jobs).length)
|
---|
17 | {
|
---|
18 | return;
|
---|
19 | }
|
---|
20 |
|
---|
21 | // fast forward iteration index
|
---|
22 | this.index = this.size;
|
---|
23 |
|
---|
24 | // abort jobs
|
---|
25 | abort(this);
|
---|
26 |
|
---|
27 | // send back results we have so far
|
---|
28 | async(callback)(null, this.results);
|
---|
29 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.