@reframework/q
v0.0.7
Published
<p align="center"> <img width="200" src="https://user-images.githubusercontent.com/49458012/210445030-69feaadd-fe6a-42f1-9828-d7e954daa63e.png"> </p>
Downloads
1
Readme
About
A simple queue
A simple queue for the front end.
Installation
npm install --save @refamework/q
Example
The queue can be initiated with a static method create()
instead or new
operator:
https://codesandbox.io/s/inspiring-sanne-yjxrhe?file=/src/App.js
import Queue from '@reframework/queue';
const queue = new Queue();
// The same with static method
const queue = Queue.create();
Api
interface IQueue<Task> {
enqueue: (task: Task) => IQueue
dequeue: (filterFn: (task: Task) => boolean) => void;
onDone: (listener: () => void) => void;
onProcess: (listener: (task: Task, next: () => void) => void) => void;
onEmpty: () => void;
pipe: (queue: IQueue) => IQueue;
}
License
MIT