A synchronous queue, nothing more

Usage no npm install needed!

<script type="module">
  import chaffityMicroQueue from 'https://cdn.skypack.dev/@chaffity/micro-queue';


Micro Queue

⏳ A super simple synchronous queue using as little code as possible

npm Bundlephobia

Module description

This module aims to provide a basic, minimalist approach to synchronous queue management. Simply invoke the module directly with a function as it's first and only argument, and that function will be called as soon as possible (with respect to any functions that may already be waiting in the queue).

Example usage

Below is a very simple example on how best to use this module. For appearances sake, and to be in keeping with the philosophy of this module, the constant q is chosen, however, if a more expressive or verbose approach is favourable use mQueue instead.

  const Queue = require('@chaffity/micro-queue');

  // Add a function to the queue, like so
  Queue((done) => {
    // ... do something snazzy

    // Then simply call the "done" method upon completion

Part of the Micro collection