Skip to content

Micro-queue provides a small, fast queue/list built for Power-Queue

License

Notifications You must be signed in to change notification settings

vatfree/cfs_micro-queue

 
 

Repository files navigation

cfs:micro-queue Build Status

Looking for maintainers - please reach out! This package is to be archived due to inability to find contributors, thanks to everyone who helped make it possible.

If you're looking for an alternative, we highly recommend Meteor-Files by VeliovGroup


MicroQueue is a simple LIFO or FIFO queue. It's faster than a simple array with pop/shift because shift is O(n) and can become slow with a large array.

This queue was built as a spinal-queue for the PowerQueue package. The interface is very basic and consists of add, get, and reset, making it possible to write a custom micro-queue for PowerQueue, such as a queue that is persisted into a database.

Note: MicroQueue can be used with PowerQueue but MicroQueue lacks the properties of n key ordered list - It does try to compensate when reinserting keys - this is especially optimized for the PowerQueue

And... It's powered by Meteor's reactive sugar :)

Kind regards Eric(@aldeed) and Morten(@raix)

Happy coding!!

#API API Documentation

From the docs:

new MicroQueue([lifo])  Anywhere

Arguments

  • lifo {boolean} (Optional = false) Set true for lifo, default is fifo

Usage:

var foo = new MicroQueue(); // Basic FIFO queue
foo.add(1);
foo.add(2);
foo.add(3);
for (var i = 0; i < foo.length(); i++) {
  console.log(foo.get());
}

The result should be: "1, 2, 3".

MicroQueue = function(lifo) { ...

See micro-queue.js:24.

Contribute

Here's the complete API documentation, including private methods.

To update the docs, run npm install docmeteor then

$ docmeteor

About

Micro-queue provides a small, fast queue/list built for Power-Queue

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%