0.1.0 • Published 11 years ago

tower-collection v0.1.0

Weekly downloads
14
License
-
Repository
-
Last release
11 years ago

Tower Collection

Arrays that automatically update your UI.

Installation

$ component install tower/collection

Example

var collection = require('tower-collection');

Create a blank collection:

collection(); // []
collection([]); // []

API

push

collection.push(item);
collection.push(item1, item2);

pop

collection.pop();

shift

Remove first item in array.

collection.shift();

unshift

Add item(s) to beginning of array.

collection.unshift(item);
collection.unshift(item1, item2);

splice(index, length, item)

Modify the original array.

collection.splice(1, 2, item);

length

collection.length;

Notes

The collection is only necessary to bind lists of data (such as queries) to the DOM. It just makes it easier to listen for changes to an array. In most other cases you can just use plain arrays and don't need the power of dirty tracking.

Licence

MIT