List
Specify the type of the DefineList
that should be instantiated by the connection.
connection.List
If this option is not specified it defaults to the Map.List property.
Usage:
var DefineMap = require("can-define/map/map");
var DefineList = require("can-define/list/list");
var canMap = require("can-connect/can/map/map");
var constructor = require("can-connect/constructor/constructor");
var dataUrl = require("can-connect/data/url/url");
var Todo = DefineMap.extend({
completed: "boolean",
complete: function(){
this.completed = true
}
});
var Todo.List = DefineList.extend({
"#": Todo,
completed: function(){
this.filter(function(todo){
return todo.completed;
});
}
});
var todoConnection = connect([dataUrl, constructor, canMap],{
Map: Todo,
List: Todo.List,
url: "/todos"
});
todoConnection.getList({}).then(function(list) {
list instanceOf Todo.List // true
})