1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 17x 83x 3x 3x 3x 3x 1x 1x 2x 2x 83x | module.exports = function(list) { var addAsync = function(values, callback, items) { var valuesToAdd = values.splice(0, 50); items = items || []; items = items.concat(list.add(valuesToAdd)); if (values.length > 0) { setTimeout(function() { addAsync(values, callback, items); }, 1); } else { list.update(); callback(items); } }; return addAsync; }; |