update tsconfig
This commit is contained in:
parent
757b992440
commit
fdaf772cfc
@ -10,12 +10,24 @@
|
||||
"githost": "code.foss.global",
|
||||
"gitscope": "push.rocks",
|
||||
"gitrepo": "taskbuffer",
|
||||
"description": "flexible task management. TypeScript ready!",
|
||||
"description": "A flexible task management library supporting TypeScript, allowing for task buffering, scheduling, and execution with dependency management.",
|
||||
"npmPackagename": "@push.rocks/taskbuffer",
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"task management",
|
||||
"TypeScript",
|
||||
"task buffering",
|
||||
"task scheduling",
|
||||
"task execution",
|
||||
"task dependencies",
|
||||
"parallel tasks",
|
||||
"task chains",
|
||||
"debounced tasks",
|
||||
"distributed coordination"
|
||||
]
|
||||
}
|
||||
},
|
||||
"tsdocs": {
|
||||
"tsdoc": {
|
||||
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
|
||||
}
|
||||
}
|
17
package.json
17
package.json
@ -2,7 +2,7 @@
|
||||
"name": "@push.rocks/taskbuffer",
|
||||
"version": "3.1.7",
|
||||
"private": false,
|
||||
"description": "flexible task management. TypeScript ready!",
|
||||
"description": "A flexible task management library supporting TypeScript, allowing for task buffering, scheduling, and execution with dependency management.",
|
||||
"main": "dist_ts/index.js",
|
||||
"typings": "dist_ts/index.d.ts",
|
||||
"type": "module",
|
||||
@ -16,11 +16,16 @@
|
||||
"url": "git+https://gitlab.com/pushrocks/taskbuffer.git"
|
||||
},
|
||||
"keywords": [
|
||||
"gulp",
|
||||
"task",
|
||||
"buffer",
|
||||
"task management",
|
||||
"TypeScript",
|
||||
"push.rocks"
|
||||
"task buffering",
|
||||
"task scheduling",
|
||||
"task execution",
|
||||
"task dependencies",
|
||||
"parallel tasks",
|
||||
"task chains",
|
||||
"debounced tasks",
|
||||
"distributed coordination"
|
||||
],
|
||||
"author": "Lossless GmbH",
|
||||
"license": "MIT",
|
||||
@ -60,4 +65,4 @@
|
||||
"browserslist": [
|
||||
"last 1 chrome versions"
|
||||
]
|
||||
}
|
||||
}
|
1
readme.hints.md
Normal file
1
readme.hints.md
Normal file
@ -0,0 +1 @@
|
||||
|
204
readme.md
204
readme.md
@ -1,61 +1,167 @@
|
||||
# @push.rocks/taskbuffer
|
||||
flexible task management. TypeScript ready!
|
||||
|
||||
## Availabililty and Links
|
||||
* [npmjs.org (npm package)](https://www.npmjs.com/package/@push.rocks/taskbuffer)
|
||||
* [gitlab.com (source)](https://gitlab.com/push.rocks/taskbuffer)
|
||||
* [github.com (source mirror)](https://github.com/push.rocks/taskbuffer)
|
||||
* [docs (typedoc)](https://push.rocks.gitlab.io/taskbuffer/)
|
||||
## Install
|
||||
To install `@push.rocks/taskbuffer`, use the following npm command:
|
||||
|
||||
## Status for master
|
||||
|
||||
Status Category | Status Badge
|
||||
-- | --
|
||||
GitLab Pipelines | [![pipeline status](https://gitlab.com/push.rocks/taskbuffer/badges/master/pipeline.svg)](https://lossless.cloud)
|
||||
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/push.rocks/taskbuffer/badges/master/coverage.svg)](https://lossless.cloud)
|
||||
npm | [![npm downloads per month](https://badgen.net/npm/dy/@push.rocks/taskbuffer)](https://lossless.cloud)
|
||||
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/push.rocks/taskbuffer)](https://lossless.cloud)
|
||||
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
|
||||
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
|
||||
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@push.rocks/taskbuffer)](https://lossless.cloud)
|
||||
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@push.rocks/taskbuffer)](https://lossless.cloud)
|
||||
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@push.rocks/taskbuffer)](https://lossless.cloud)
|
||||
|
||||
## Usage
|
||||
|
||||
We highly recommend TypeScript as this module supports **TypeScript intellisense**.
|
||||
|
||||
```javascript
|
||||
import * as taskbuffer from "taskbuffer";
|
||||
|
||||
myTask = new taskbuffer.Task({
|
||||
preTask: someOtherTask // optional, don't worry loops are prevented
|
||||
afterTask: someOtherTask // optional, don't worry loops are prevented
|
||||
name:"myTask1",
|
||||
buffered: true, // optional
|
||||
bufferMax: 3, // optional, call qeues greater than this are truncated
|
||||
execDelay: 1000, // optional, time in ms to wait before executing task call
|
||||
taskFunction:() => {
|
||||
// do some stuff and return promise
|
||||
// pass on any data through promise resolution
|
||||
// Use TypeScript for better understanding and code completion
|
||||
}
|
||||
})
|
||||
```bash
|
||||
npm install @push.rocks/taskbuffer --save
|
||||
```
|
||||
|
||||
For further information read the linked docs at the top of this README.
|
||||
This will add `@push.rocks/taskbuffer` to your project's dependencies, allowing you to use it within your TypeScript project.
|
||||
|
||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||
## Usage
|
||||
`@push.rocks/taskbuffer` offers a versatile way to manage tasks in your application. Whether you need simple asynchronous task execution, buffered tasks to limit concurrent executions, or more complex scenarios involving task chaining and parallel execution, `@push.rocks/taskbuffer` has got you covered. Below, you'll find detailed examples showcasing the module's capabilities and how to use them in TypeScript.
|
||||
|
||||
[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://push.rocks)
|
||||
### Basic Task Execution
|
||||
To create and run a simple task:
|
||||
|
||||
## Contribution
|
||||
```typescript
|
||||
import { Task } from '@push.rocks/taskbuffer';
|
||||
|
||||
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
|
||||
const simpleTask = new Task({
|
||||
name: 'SimpleTask',
|
||||
taskFunction: async () => {
|
||||
console.log('Executing a simple task');
|
||||
// Perform your task here (e.g., fetch data from an API)
|
||||
}
|
||||
});
|
||||
|
||||
For further information read the linked docs at the top of this readme.
|
||||
// Trigger the task
|
||||
simpleTask.trigger();
|
||||
```
|
||||
|
||||
## Legal
|
||||
> MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc)
|
||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
||||
This basic example creates a task that prints a message to the console when executed.
|
||||
|
||||
### Buffered Task Execution
|
||||
Buffered tasks allow you to throttle task executions, for example, to avoid overwhelming a server with simultaneous requests:
|
||||
|
||||
```typescript
|
||||
import { Task } from '@push.rocks/taskbuffer';
|
||||
|
||||
const bufferedTask = new Task({
|
||||
name: 'BufferedTask',
|
||||
taskFunction: async () => {
|
||||
// Task implementation
|
||||
console.log('Buffered task execution');
|
||||
},
|
||||
buffered: true,
|
||||
bufferMax: 3 // Maximum number of concurrent executions
|
||||
});
|
||||
|
||||
// Trigger the task multiple times
|
||||
bufferedTask.trigger();
|
||||
bufferedTask.trigger();
|
||||
bufferedTask.trigger();
|
||||
bufferedTask.trigger();
|
||||
```
|
||||
|
||||
In this scenario, only three instances of `bufferedTask` will run concurrently, thanks to the buffer settings.
|
||||
|
||||
### Task Chains
|
||||
Task chains are a powerful feature that allows you to execute tasks in a specified order:
|
||||
|
||||
```typescript
|
||||
import { Task, Taskchain } from '@push.rocks/taskbuffer';
|
||||
|
||||
const firstTask = new Task({
|
||||
name: 'FirstTask',
|
||||
taskFunction: async () => {
|
||||
console.log('First task execution');
|
||||
// First task logic
|
||||
}
|
||||
});
|
||||
|
||||
const secondTask = new Task({
|
||||
name: 'SecondTask',
|
||||
taskFunction: async () => {
|
||||
console.log('Second task execution');
|
||||
// Second task logic
|
||||
}
|
||||
});
|
||||
|
||||
const taskChain = new Taskchain({
|
||||
name: 'MyTaskChain',
|
||||
taskArray: [firstTask, secondTask] // Tasks will be executed in the order they are provided
|
||||
});
|
||||
|
||||
// Trigger the task chain
|
||||
taskChain.trigger();
|
||||
```
|
||||
|
||||
### Parallel Task Execution
|
||||
To run tasks in parallel, use `Taskparallel`:
|
||||
|
||||
```typescript
|
||||
import { Task, Taskparallel } from '@push.rocks/taskbuffer';
|
||||
|
||||
const taskOne = new Task({
|
||||
name: 'TaskOne',
|
||||
taskFunction: async () => {
|
||||
// Task one logic
|
||||
console.log('Task one execution');
|
||||
}
|
||||
});
|
||||
|
||||
const taskTwo = new Task({
|
||||
name: 'TaskTwo',
|
||||
taskFunction: async () => {
|
||||
// Task two logic
|
||||
console.log('Task two execution');
|
||||
}
|
||||
});
|
||||
|
||||
const parallelTask = new Taskparallel({
|
||||
taskArray: [taskOne, taskTwo] // These tasks will be executed in parallel
|
||||
});
|
||||
|
||||
// Trigger the parallel tasks
|
||||
parallelTask.trigger();
|
||||
```
|
||||
|
||||
### Task Scheduling with Task Manager
|
||||
`@push.rocks/taskbuffer` also provides a `TaskManager` to schedule tasks using cron expressions:
|
||||
|
||||
```typescript
|
||||
import { Task, TaskManager } from '@push.rocks/taskbuffer';
|
||||
|
||||
const scheduledTask = new Task({
|
||||
name: 'ScheduledTask',
|
||||
taskFunction: async () => {
|
||||
console.log('Scheduled task execution');
|
||||
// Task logic here
|
||||
}
|
||||
});
|
||||
|
||||
const taskManager = new TaskManager();
|
||||
taskManager.addAndScheduleTask(scheduledTask, '0 * * * * *'); // Execute task at the start of every minute
|
||||
|
||||
// Start the task manager to enable the scheduled execution
|
||||
taskManager.start();
|
||||
```
|
||||
|
||||
### Advanced Use Cases
|
||||
The flexibility of `@push.rocks/taskbuffer` allows for more sophisticated task management scenarios. You can combine the features mentioned above to fit your specific needs, such as chaining parallel tasks, dynamically adding tasks to a manager or chain based on conditions, and much more.
|
||||
|
||||
`@push.rocks/taskbuffer` leverages TypeScript's advanced typing features to provide you with clear and predictable APIs, making it easier to build and maintain complex task management logic within your application.
|
||||
|
||||
For further information and advanced configurations, please refer to the [official documentation](https://gitlab.com/pushrocks/taskbuffer).
|
||||
|
||||
## License and Legal Information
|
||||
|
||||
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
|
||||
|
||||
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
|
||||
|
||||
### Trademarks
|
||||
|
||||
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
|
||||
|
||||
### Company Information
|
||||
|
||||
Task Venture Capital GmbH
|
||||
Registered at District court Bremen HRB 35230 HB, Germany
|
||||
|
||||
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
|
||||
|
||||
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
|
||||
|
Loading…
Reference in New Issue
Block a user