-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
47 lines (36 loc) · 909 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const mod = {
OLSKQueueAPI (inputData = {}) {
if (typeof inputData !== 'undefined') {
if (typeof inputData !== 'object' || inputData === null) {
throw new Error('OLSKErrorInputNotValid');
}
}
return {
OLSKQueueAdd (inputData) {
if (typeof inputData !== 'function') {
throw new Error('OLSKErrorInputNotValid');
}
const _this = this;
return new Promise(function (res, rej) {
_this._OLSKQueueObject.push(async function (_queue_callback) {
try {
return _queue_callback(null, res(await inputData()));
} catch (error) {
return rej(error);
}
});
});
},
_OLSKQueueObject: this._DataFoilQueue(Object.assign(mod._DataQueueConfig(), inputData)),
};
},
// DATA
_DataFoilQueue: require('queue'),
_DataQueueConfig () {
return {
concurrency: 1,
autostart: true,
};
},
};
Object.assign(exports, mod);