qquuee
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

qquuee

simple typesafe queue

Quick start

Install it:

npm i qquuee
# or
yarn add qquuee
# or
pnpm add qquuee

Use it:

import Q from 'qquuee'

const delay = <T>(value: T, time: number) =>
  new Promise<T>(resolve => 
    setTimeout(
      () => resolve(value), 
      time
    )
  )

const q = new Q()

q.add(() => delay(0, 1000))
q.add(() => delay(1, 500))

// after 1000ms: 0
// after 500ms:  1
const task = q.add(() => delay(0, 1000))
task // will be typed Promise<number>

Readme

Keywords

none

Package Sidebar

Install

npm i qquuee

Weekly Downloads

1

Version

0.0.3

License

none

Unpacked Size

12.5 kB

Total Files

25

Last publish

Collaborators

  • bigmistqke