2.0.1 • Published 12 years ago
attr-range v2.0.1
attr-range
find ranges for wiring up live automatically updating collections
example
var arange = require('attr-range');
var rangef = arange(function (range) {
console.log(range);
});
var elems = document.querySelectorAll('*[data-start]');
for (var i = 0; i < elems.length; i++) {
rangef(elems[i]);
}methods
var arange = require('attr-range');var rangef = arange(start='data-start', end='data-end', function (range) {})
Register a callback to fire when range elements have been gathered.
range objects have:
range.start- start key in the collection rangerange.end- end key in the collection rangerange.range- object with onlystartandendkeys; useful for handing todb.createReadStream()range.element- container element for all the items in the range
rangef(elem)
Call the rangef() function on each element elem that has the start and end
keys to populate the callback with.
install
With npm do:
npm install attr-rangelicense
MIT