tower-collection

0.1.0 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i tower-collection

Weekly Downloads

0

Version

0.1.0

License

none

Last publish

Collaborators

  • viatropos