@gershy/util-throttler 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cmp/cjs/main.js +4 -4
- package/cmp/mjs/main.js +4 -4
- package/package.json +2 -2
package/cmp/cjs/main.js
CHANGED
|
@@ -8,15 +8,15 @@ class Throttler {
|
|
|
8
8
|
pending;
|
|
9
9
|
constructor(limit) {
|
|
10
10
|
if (limit < 1)
|
|
11
|
-
throw Error('limit too low')[mod]({ limit });
|
|
11
|
+
throw Error('limit too low')[cl.mod]({ limit });
|
|
12
12
|
if (Math.floor(limit) !== limit)
|
|
13
|
-
throw Error('limit invalid')[mod]({ limit });
|
|
13
|
+
throw Error('limit invalid')[cl.mod]({ limit });
|
|
14
14
|
this.limit = limit;
|
|
15
15
|
this.active = new Set();
|
|
16
16
|
this.pending = [];
|
|
17
17
|
}
|
|
18
18
|
finish(donePrm) {
|
|
19
|
-
this.active[rem](donePrm);
|
|
19
|
+
this.active[cl.rem](donePrm);
|
|
20
20
|
const next = this.pending.shift();
|
|
21
21
|
if (!next)
|
|
22
22
|
return;
|
|
@@ -30,7 +30,7 @@ class Throttler {
|
|
|
30
30
|
this.active.add(prm);
|
|
31
31
|
return prm.finally(() => this.finish(prm));
|
|
32
32
|
}
|
|
33
|
-
const prm = Promise[later]();
|
|
33
|
+
const prm = Promise[cl.later]();
|
|
34
34
|
this.pending.push({ prm, fn });
|
|
35
35
|
return prm;
|
|
36
36
|
}
|
package/cmp/mjs/main.js
CHANGED
|
@@ -6,15 +6,15 @@ export default class Throttler {
|
|
|
6
6
|
pending;
|
|
7
7
|
constructor(limit) {
|
|
8
8
|
if (limit < 1)
|
|
9
|
-
throw Error('limit too low')[mod]({ limit });
|
|
9
|
+
throw Error('limit too low')[cl.mod]({ limit });
|
|
10
10
|
if (Math.floor(limit) !== limit)
|
|
11
|
-
throw Error('limit invalid')[mod]({ limit });
|
|
11
|
+
throw Error('limit invalid')[cl.mod]({ limit });
|
|
12
12
|
this.limit = limit;
|
|
13
13
|
this.active = new Set();
|
|
14
14
|
this.pending = [];
|
|
15
15
|
}
|
|
16
16
|
finish(donePrm) {
|
|
17
|
-
this.active[rem](donePrm);
|
|
17
|
+
this.active[cl.rem](donePrm);
|
|
18
18
|
const next = this.pending.shift();
|
|
19
19
|
if (!next)
|
|
20
20
|
return;
|
|
@@ -28,7 +28,7 @@ export default class Throttler {
|
|
|
28
28
|
this.active.add(prm);
|
|
29
29
|
return prm.finally(() => this.finish(prm));
|
|
30
30
|
}
|
|
31
|
-
const prm = Promise[later]();
|
|
31
|
+
const prm = Promise[cl.later]();
|
|
32
32
|
this.pending.push({ prm, fn });
|
|
33
33
|
return prm;
|
|
34
34
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gershy/util-throttler",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "TODO",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"TODO"
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"homepage": "https://github.com/gershy/utilThrottler#readme",
|
|
17
17
|
"license": "ISC",
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"@gershy/clearing": "^0.0.
|
|
19
|
+
"@gershy/clearing": "^0.0.36"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/node": "^24.10.1",
|