Map
Specify the type of the DefineMap
that should be instantiated by the connection.
connection.Map
Defaults to DefaultMap if this option is not specified.
Usage:
var DefineMap = require("can-define/map/map");
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 todoConnection = connect([dataUrl, constructor, canMap], {
Map: Todo,
url: "/todos"
});
todoConnect.get({id:1}).then(function(item) {
item instanceof Todo // true
});