# @mobilabs/taskq

> A library that processes tasks sequentially

Latest version **1.0.2** (published 2024-01-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install @mobilabs/taskq
pnpm add @mobilabs/taskq
yarn add @mobilabs/taskq
bun add @mobilabs/taskq
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2024-01-29 |
| First published | 2019-09-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 37.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Mobilabs |
| Maintainers | jclo |
| Keywords | ES6 |

## Links

- npm: https://www.npmjs.com/package/@mobilabs/taskq
- Repository: https://github.com/jclo/taskq
- Issues: https://github.com/jclo/taskq/issues
- npm.io page: https://npm.io/package/@mobilabs/taskq

## Recent versions

- 1.0.2 (latest) — 2024-01-29
- 1.0.1 — 2022-01-29
- 1.0.0 — 2020-08-28
- 0.0.7 — 2020-08-10
- 0.0.6 — 2020-08-10
- 0.0.5 — 2020-04-01
- 0.0.4 — 2020-03-21
- 0.0.3 — 2020-03-17
- 0.0.2 — 2019-12-27
- 0.0.1 — 2019-12-10
- 0.0.0 — 2019-09-20

## README

# TaskQ

[![NPM version][npm-image]][npm-url]
[![GitHub last commit][commit-image]][commit-url]
[![Github workflow][ci-image]][ci-url]
[![Test coverage][coveralls-image]][coveralls-url]
[![npm bundle size][npm-bundle-size-image]][npm-bundle-size-url]
[![License][license-image]](LICENSE.md)


`TaskQ` is a Javascript library that allows tasks to be executed sequentially.

It is designed to be embedded in another library. `TaskQ` run on both Node.js and ECMAScript 2015 (ES6) compliant browsers.


## Quick Startup

This example shows how to store tasks, in the `Task Queue`, that must be processed sequentially. As soon as a task is stored in the queue, it is executed. When it is completed, it launches the next task thanks to the function `next` and so on until the queue is empty.

```js
// Create the taskQ object:
const taskQ = TaskQ();

// Define an heavy tasks
function heavy(next) {
  doSomethingComplex();
  next();
}

// Push tasks in the Queue:
taskQ.pushQ('aaa', (next) => {
  heavyTask1(next);
});

taskQ.pushQ('aaa', (next) => {
  heavyTask12(next);
});
```


## API

## Static methods

`TaskQ` provides one static method. You can use it by typing:

```javascript
TaskQ.noConflict();
```

| Static Methods       | Description |
|:---------------------|:------------|
| noConflict           | returns the TaskQ variable to its previous owner |



## Create a TaskQ object:

| Constructor | Description |
|:------------|:------------|
| TaskQ() | creates the TaskQ object that processes tasks |


## Methods

| Methods  | Description |
|:--------------------|:------------|
| pushQ(queue, task)  | pushes, in a dedicated queue, a task that need to be processed after the previous one |
| popQ(queue, task)   | pushes, in a dedicated queue, a task that need to be processed just after the running task is completed |


## License

[MIT](LICENSE.md).

<!--- URls -->

[npm-image]: https://img.shields.io/npm/v/@mobilabs/taskq.svg?style=flat-square
[release-image]: https://img.shields.io/github/release/jclo/taskq.svg?include_prereleases&style=flat-square
[commit-image]: https://img.shields.io/github/last-commit/jclo/taskq.svg?style=flat-square
[ci-image]: https://github.com/jclo/taskq/actions/workflows/ci.yml/badge.svg
[coveralls-image]: https://img.shields.io/coveralls/jclo/taskq/master.svg?style=flat-square
[npm-bundle-size-image]: https://img.shields.io/bundlephobia/minzip/@mobilabs/taskq.svg?style=flat-square
[license-image]: https://img.shields.io/npm/l/@mobilabs/taskq.svg?style=flat-square

[npm-url]: https://www.npmjs.com/package/@mobilabs/taskq
[release-url]: https://github.com/jclo/taskq/tags
[commit-url]: https://github.com/jclo/taskq/commits/master
[ci-url]: https://github.com/jclo/taskq/actions/workflows/ci.yml
[coveralls-url]: https://coveralls.io/github/jclo/taskq?branch=master
[npm-bundle-size-url]: https://img.shields.io/bundlephobia/minzip/@mobilabs/taskq
[license-url]: http://opensource.org/licenses/MIT

---
_Source: https://npm.io/package/@mobilabs/taskq · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
