peerigon / alamid-list Goto Github PK
View Code? Open in Web Editor NEWSimple observable arrays
License: MIT License
Simple observable arrays
License: MIT License
Would be nice to use alamid-list with underscore-functions
var list = require("alamid-list");
list.use(require("alamid-list/plugins/underscore"),
{ underscore: require("underscore") });
list.pluck("name"); // ["moe", "larry", "curly"]
If I don't want to wrap an array (because I just want to expose an array instead of an instance of alamid-list), it would be useful to just override the array methods:
List.patch(arr);
arr.on("add", function () {})
It would be cool to create a pointer which updates itself when elements are being added:
var list = new List([1,2,3])
var pointer = list.pointer(1);
pointer(); // 1, equals the given index
list.unshift(0); // [0, 1, 2, 3]
pointer(); // 2, equals the new index, because an element has been added
list.push(4); // [0, 1, 2, 3, 4]
pointer(); // 2, because an element has been appended which doesn't affect the pointer
list.push(5); // [0, 1, 2, 3, 4, 5]
list.reverse(); // [5, 4, 3, 2, 1, 0]
pointer(); // 3, because the order has been changed
list.splice(3, 1); // [5, 4, 3, 1, 0]
pointer(); // 3, because the pointer is not connected to the element it points to
But what happens on sort()
? Probably the best solution is to retrieve the element where the pointer points to and then, after sort()
use indexOf()
to determine where the element was placed.
Like W3C's Event API
The word element clashes with DOM elements. Should be the same with alamid-set
It would be nice to make a list unique. In order to accomplish this the plugin needs to iterate the array to look for the element. The plugin should recognize a sorted list and use an optimized algorithm.
In Firefox Object.prototype.watch
is defined which breaks the initialization code of the watch-plugin.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.