can-connect
can-connect copied to clipboard
disable/add behaviors and cacheConnection in superMap ~8
trafficstars
SUMMARY: There should be a way to disable or add certain behaviors and the cacheConnection (or provide your own cacheConnection) to superMap.
if you are on developing, some request failed other reponse a wrong set and so on. it would be nice if we can disable the default localstorage-cache while developing.
for now i do something like that:
var options = {
name: "wwas"
};
global['cacheConnection'] = connect(["data-localstorage-cache"], {
name: options.name + "Cache"
});
global['cacheConnection'].clear();
var Todo = can.Map.extend({});
Todo.List = can.List.extend({
Map: Todo
},{});
var todoConnection = connect.superMap({
name: options.name,
cacheConnection: global['cacheConnection'],
Map: Todo,
url: {
getListData: "POST "+global.Config.baseUrl+"/ajax/geplant/get-wwas.ajax"
}
});
todoConnection.getListData({});