0.0.7 • Published 2 years ago
@reframework/q v0.0.7
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