@schukai/monster 3.51.2 → 3.51.3
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/source/types/version.mjs +1 -1
- package/source/util/processing.mjs +16 -13
- package/test/cases/monster.mjs +1 -1
package/package.json
CHANGED
package/source/types/version.mjs
CHANGED
@@ -5,14 +5,14 @@
|
|
5
5
|
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
|
6
6
|
*/
|
7
7
|
|
8
|
-
import {
|
9
|
-
import {
|
10
|
-
import {
|
11
|
-
import {
|
12
|
-
import {
|
13
|
-
import {
|
8
|
+
import {internalSymbol} from "../constants.mjs";
|
9
|
+
import {Base} from "../types/base.mjs";
|
10
|
+
import {getGlobalFunction} from "../types/global.mjs";
|
11
|
+
import {isFunction, isInteger} from "../types/is.mjs";
|
12
|
+
import {Queue} from "../types/queue.mjs";
|
13
|
+
import {validateFunction, validateInteger} from "../types/validate.mjs";
|
14
14
|
|
15
|
-
export {
|
15
|
+
export {Processing};
|
16
16
|
|
17
17
|
/**
|
18
18
|
* @private
|
@@ -86,9 +86,8 @@ class Processing extends Base {
|
|
86
86
|
*
|
87
87
|
* So the execution time is timeout1+timeout1+timeout1+timeout2
|
88
88
|
*
|
89
|
-
* @param {int} timeout Timeout
|
90
|
-
* @param {function} callback Callback
|
91
89
|
* @throw {TypeError} the arguments must be either integer or functions
|
90
|
+
* @param {...(int|function)} args
|
92
91
|
*/
|
93
92
|
constructor(...args) {
|
94
93
|
super();
|
@@ -136,13 +135,17 @@ class Processing extends Base {
|
|
136
135
|
*/
|
137
136
|
run(data) {
|
138
137
|
const self = this;
|
139
|
-
if (
|
138
|
+
if (self[internalSymbol].queue.isEmpty()) {
|
140
139
|
return Promise.resolve(data);
|
141
140
|
}
|
142
141
|
|
143
|
-
|
144
|
-
|
145
|
-
|
142
|
+
const callback = self[internalSymbol].queue.poll();
|
143
|
+
|
144
|
+
if (callback === null || callback === undefined) {
|
145
|
+
return Promise.resolve(data);
|
146
|
+
}
|
147
|
+
|
148
|
+
return callback.run(data)
|
146
149
|
.then((result) => {
|
147
150
|
return self.run(result);
|
148
151
|
});
|
package/test/cases/monster.mjs
CHANGED