zcfs:reactive-list
Looking for maintainers - please reach out!
This package is to be archived due to inability to find contributors, thanks to everyone who helped make it possible.
If you're looking for an alternative, we highly recommend Meteor-Files by VeliovGroup
ReactiveList keeps a sortable reactive list of key+value items. It's simple and fast.
And... It's powered by Meteor's reactive sugar :)
Kind regards,
Eric (@aldeed) and Morten (@raix)
Happy coding!!
#API API Documentation
From the docs:
new ReactiveList([options], sort) Anywhere
Arguments
- options {object} (Optional)
- sort {function}
The sort algorithm to use
Example:
1 var list = new ReactiveList(); 2 list.insert(1, { text: 'Hello id: 1' }); 3 list.insert(2, { text: 'Hello id: 2' }); 4 list.insert(3, { text: 'Hello id: 3' }); 5 list.update(2, { text: 'Updated 2'}); 6 list.remove(1); 7 8 list.forEach(function(value, key) { 9 console.log('GOT: ' + value.text); 10 }, true); // Set noneReactive = true, default behaviour is reactive 11 // Return from Template: 12 Template.hello.list = function() { 13 return list.fetch(); 14 };
Example of a sort algorithm
Sort can be used to define the order of the list
1 var list = new ReactiveList({ 2 sort: function(a, b) { 3 // a and b are type of { key, value } 4 // here we sort by the key: 5 return a.key < b.key; 6 } 7 });
Object chain
first last undefined - obj - obj - obj - undefined (prev value next) (prev value next) (prev value next)
ReactiveList = function(options) { ...
See more at reactive-list.js:46.
Contribute
Here's the complete API documentation. To update the docs, run npm install docmeteor
, then
$ docmeteor