Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var update = function(changes){
helpers.forEach.call(changes, function(change){
if(change.type === "add") {
// Create the `todoItem` and insert it in the right spot
var li = todoItem(todos[change.name]).hide();
if(element.children().length) {
element.children().eq(change.name-1).after( li );
} else {
element.append(li);
}
li.fadeIn();
}
else if(change.type === "delete") {
// Find the `todoItem` to remove.
// Trigger an event so it can tear itself down.
// Animate and remove the `todoItem` element.
var li = element.children().eq( change.name );
li.triggerHandler("remove");
* });
*
* var todoConnection = connect(["data-url","fall-through-cache"],{
* url: "/services/todos",
* cacheConnection: cacheConnection
* });
* ```
*
*/
var getItems = require("can-connect/helpers/get-items");
var connect = require("can-connect");
var sortedSetJSON = require("can-connect/helpers/sorted-set-json");
var canSet = require("can-set");
require("when/es6-shim/Promise");
var helpers = require("can-connect/helpers/");
var forEach = helpers.forEach;
var map = helpers.map;
//
var indexOf = function(connection, props, items){
var id = connection.id(props);
for(var i = 0; i < items.length; i++) {
if( id == connection.id(items[i]) ) {
return i;
}
}
return -1;
};
var setAdd = function(set, items, item, algebra){
return items.concat([item]);
};
var connect = require("can-connect");
var canSet = require("can-set");
var getItems = require("can-connect/helpers/get-items");
var forEach = require("can-connect/helpers/").forEach;
/**
* @module can-connect/data/combine-requests data-combine-requests
* @parent can-connect.behaviors
* @group can-connect/data/combine-requests.data-methods Data Methods
* @group can-connect/data/combine-requests.options Options
* @group can-connect/data/combine-requests.algebra Algebra Methods
* @group can-connect/data/combine-requests.types Types
*
* Combines multiple incoming requests into one if possible.
*
* @signature `dataCombineRequests(baseConnection)`
*
* Overwrites [can-connect/data/combine-requests.getListData] to collect the requested
* sets for
* some [can-connect/data/combine-requests.time]. Once that time has expired, it tries