@lauf/queue
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

Minimal in-memory message queue

A Typescript queue implementation with...

Read the API Reference or the reference usages below.

Usage

// Create a queue that accepts any values
const queue = createQueue();

// put an event in the queue
queue.send({
  kind: "move",
  x: 200,
  y: 200,
});

// block until next event is available
const action = await queue.receive();
// define an event type
interface Coordinate {
  x: number;
  y: number;
}

// Create a queue for typed events
const typedQueue = createQueue<Coordinate>();

// block until next event is available
const { x, y } = await queue.receive();

Import OR Require

import { createQueue } from "@lauf/queue"; // for esm
const { createQueue } = require("@lauf/queue"); // for commonjs

Getting Started

Install

npm install @lauf/queue

Readme

Keywords

none

Package Sidebar

Install

npm i @lauf/queue

Weekly Downloads

1

Version

2.0.0

License

MIT

Unpacked Size

11.2 kB

Total Files

14

Last publish

Collaborators

  • cefn