data-queue

0.0.3 • Public • Published

data-queue

Queue and get data

Usage

const Queue = require("data-queue")
 
const queue = Queue() //create without new
 
queue.get((err, data) => { //this will wait for .append()/.prepend() or .error() calls
  console.log(data)
  queue.get((err, data) => {
    if (err) throw err //Throw the error
  })
})
 
queue.append("Hi there")
 
queue.error(new Error("Something fatal happened"))
 
queue.append("What's up?") //This won't append the data. instead it will return the error
 
console.log(queue.height()) //This gets the number of items in the queue

Readme

Keywords

Package Sidebar

Install

npm i data-queue

Weekly Downloads

105

Version

0.0.3

License

MIT

Last publish

Collaborators

  • mkg20001