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