node package manager

Introducing npm Enterprise add-ons. Integrate third-party dev tools into npm…

dom-queue

A queue for the DOM

dom-queue

A queue for the DOM. Not really a queue, but whatevs.

var Queue = require('dom-queue');
var q = Queue({container: 'some-list'});
 
q.push('a');
q.push('b');
q.push('c');

Outputs:

<ul class="some-list">
    <li class="item">a</li>
    <li class="item">b</li>
    <li class="item">c</li>
</ul>

var q = Queue(options={})

options consist of:

  • container default: queue
  • tag default: ul
  • parent default: body
  • childTag default: li if parent is ul. span otherwise.

Push an item onto the queue.

Remove the last item that was pushed.

Remove the first item.

Remove the item where index is in the list.

Clears items in the queue, but leaves the container.