# quicktask

> Tiny microtask queue scheduler for all environments

Latest version **1.2.0** (published 2022-01-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install quicktask
pnpm add quicktask
yarn add quicktask
bun add quicktask
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2022-01-13 |
| First published | 2018-06-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 16 |
| Author | staltz.com |
| Maintainers | staltz |
| Keywords | microtask, nanotask, schedule |

## Links

- npm: https://www.npmjs.com/package/quicktask
- Repository: https://github.com/staltz/quicktask
- Issues: https://github.com/staltz/quicktask/issues
- npm.io page: https://npm.io/package/quicktask

## Recent versions

- 1.2.0 (latest) — 2022-01-13
- 1.1.0 — 2018-06-25
- 1.0.1 — 2018-06-09
- 1.0.0 — 2018-06-03

## README

# Quicktask

> Tiny microtask queue scheduler for all environments

```bash
npm install --save quicktask
```

Inspired by `yoshuawuyts/nanotask`, this function manages a queue of microtasks, but focuses on being cross environment (not just browser) and with a tiny implementation. It returns a "scheduleMicrotask" helper.

- Uses `queueMicrotask` if available
- Otherwise uses `setImmediate` if available.
- Otherwise uses `process.nextTick` in Node.js.
- Otherwise uses `setTimeout` otherwise.

**Unless you need to support old runtimes or Internet Explorer, we recommend using `queueMicrotask` directly**. That said, this library is less than 1kB in size.

## Usage

In JavaScript / Node.js:

```js
const quicktask = require('quicktask').default;
const schedule = quicktask();

schedule(function () {
  console.log('resolved at the start of the next frame');
});
```

In TypeScript:

```typescript
import quicktask from 'quicktask';
const schedule = quicktask();

schedule(() => {
  console.log('resolved at the start of the next frame');
});
```

## API

### `const schedule = quicktask()`

Create a new Quicktask instance.

### `schedule(fn)`

Queue a function to run before the end of the current event loop.

## License

[MIT](https://tldrlegal.com/license/mit-license)

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