fix(core): update
This commit is contained in:
parent
493cd83dda
commit
b5981d67cf
20
package.json
20
package.json
@ -30,20 +30,20 @@
|
||||
"homepage": "https://gitlab.com/pushrocks/taskbuffer#readme",
|
||||
"dependencies": {
|
||||
"@push.rocks/isounique": "^1.0.5",
|
||||
"@push.rocks/lik": "^6.0.0",
|
||||
"@push.rocks/lik": "^6.0.3",
|
||||
"@push.rocks/smartdelay": "^3.0.5",
|
||||
"@push.rocks/smartlog": "^3.0.1",
|
||||
"@push.rocks/smartlog": "^3.0.3",
|
||||
"@push.rocks/smartpromise": "^4.0.3",
|
||||
"@push.rocks/smartrx": "^3.0.0",
|
||||
"@push.rocks/smarttime": "^4.0.1"
|
||||
"@push.rocks/smartrx": "^3.0.6",
|
||||
"@push.rocks/smarttime": "^4.0.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.1.63",
|
||||
"@gitzone/tsbundle": "^2.0.6",
|
||||
"@gitzone/tsrun": "^1.2.39",
|
||||
"@gitzone/tstest": "^1.0.72",
|
||||
"@push.rocks/tapbundle": "^5.0.4",
|
||||
"@types/node": "^18.11.18"
|
||||
"@gitzone/tsbuild": "^2.1.66",
|
||||
"@gitzone/tsbundle": "^2.0.8",
|
||||
"@gitzone/tsrun": "^1.2.44",
|
||||
"@gitzone/tstest": "^1.0.77",
|
||||
"@push.rocks/tapbundle": "^5.0.12",
|
||||
"@types/node": "^20.4.5"
|
||||
},
|
||||
"files": [
|
||||
"ts/**/*",
|
||||
|
2306
pnpm-lock.yaml
generated
2306
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/taskbuffer',
|
||||
version: '3.0.11',
|
||||
version: '3.0.12',
|
||||
description: 'flexible task management. TypeScript ready!'
|
||||
}
|
||||
|
@ -2,8 +2,9 @@ import { Task } from './taskbuffer.classes.task.js';
|
||||
|
||||
export class BufferRunner {
|
||||
public task: Task;
|
||||
// initialze by default
|
||||
// initialize by default
|
||||
public bufferCounter: number = 0;
|
||||
|
||||
constructor(taskArg: Task) {
|
||||
this.task = taskArg;
|
||||
}
|
||||
@ -13,7 +14,7 @@ export class BufferRunner {
|
||||
this.bufferCounter++;
|
||||
}
|
||||
const returnPromise: Promise<any> = this.task.cycleCounter.getPromiseForCycle(
|
||||
this.bufferCounter + 1
|
||||
this.bufferCounter
|
||||
);
|
||||
if (!this.task.running) {
|
||||
this._run(x);
|
||||
@ -21,19 +22,13 @@ export class BufferRunner {
|
||||
return returnPromise;
|
||||
}
|
||||
|
||||
private _run(x: any) {
|
||||
const recursiveBufferRunner = (x: any) => {
|
||||
if (this.bufferCounter >= 0) {
|
||||
this.task.running = true;
|
||||
Task.runTask(this.task, { x: x }).then((x) => {
|
||||
this.bufferCounter--; // this.bufferCounter drops below 0, the recursion stops.
|
||||
this.task.cycleCounter.informOfCycle(x);
|
||||
recursiveBufferRunner(x);
|
||||
});
|
||||
} else {
|
||||
this.task.running = false;
|
||||
}
|
||||
};
|
||||
recursiveBufferRunner(x);
|
||||
private async _run(x: any) {
|
||||
this.task.running = true;
|
||||
while (this.bufferCounter > 0) {
|
||||
const result = await Task.runTask(this.task, { x: x });
|
||||
this.bufferCounter--;
|
||||
this.task.cycleCounter.informOfCycle(result);
|
||||
}
|
||||
this.task.running = false;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as plugins from './taskbuffer.plugins.js';
|
||||
|
||||
import { Task, ITaskFunction } from './taskbuffer.classes.task.js';
|
||||
import { Task, type ITaskFunction } from './taskbuffer.classes.task.js';
|
||||
|
||||
export class TaskDebounced<T = unknown> extends Task {
|
||||
private _debouncedTaskFunction: ITaskFunction;
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as plugins from './taskbuffer.plugins.js';
|
||||
|
||||
import { Task, ITaskFunction } from './taskbuffer.classes.task.js';
|
||||
import { Task, type ITaskFunction } from './taskbuffer.classes.task.js';
|
||||
|
||||
/**
|
||||
* TaskOnce is run exactly once, no matter how often it is triggered
|
||||
|
@ -5,6 +5,7 @@
|
||||
"target": "ES2022",
|
||||
"module": "ES2022",
|
||||
"moduleResolution": "nodenext",
|
||||
"esModuleInterop": true
|
||||
"esModuleInterop": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user