我希望能够在 WinJS.Binding.List 投影上使用原型方法(例如 createFiltered)。
例子:
WinJS.Binding.List.prototype.shoutLength = function () {
console.log("MY LENGTH IS " + this.length);
}
var list = new WinJS.Binding.List([2,1,3]);
var filtered = list.createFiltered(function (item) { return item <= 2; });
list.length; // outputs 3
filtered.length; // outputs 2
list.shoutLength(); // works
filtered.shoutLength(); // doesn't work (Object doesn't support property or method 'shoutLength')
我可以将原型应用于什么,以便它可以处理过滤投影、排序投影、分组投影等?