0.0.3 • Published 10 years ago
q.js-queue v0.0.3
Q.js
NodeJS Queue module that can be used for a limitless amount of things and just works!
//Create new queues queue.init('login');
queue.use('login').add('abe'); //queue = abe name = queue.use('login').shift(); //abe
<h3>Adding to Queues</h3>
```javascript
queue.use('login').add('abe').add('bob').add('chris');
queue.use('login').add('derek');
//queue = [abe,bob,chris,derek]
queue.shift()
//queue = bob
<h3>Removing from Queues</h3>
```javascript
queue.use('login').add('abe').add('bob');
queue.remove(1);
//queue = [abe]
queue.use('login').loop(function(q) { if(q.get() === 'bob') q.remove();
q.get();
//return: Loop #1 abe #2 bob #3 chris
q.remove()
//removes the current row from the queue
}) //queue = abe,chris
<h3>Fetching</h3>
```javascript
queue.use('login').add('abe').add('bob');
queue.use('login').fetch();
//return = [abe,bob]
0.0.3
10 years ago