can-connect icon indicating copy to clipboard operation
can-connect copied to clipboard

disable/add behaviors and cacheConnection in superMap ~8

Open pYr0x opened this issue 9 years ago • 0 comments
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({});

pYr0x avatar Apr 17 '16 16:04 pYr0x