Browse Source

Complete callback only executed once after all files

pull/62/head
Matthew Holt 11 years ago
parent
commit
311caa2f52
  1. 20
      papaparse.js

20
papaparse.js

@ -49,12 +49,7 @@
&& $(this).attr('type').toLowerCase() == "file" && $(this).attr('type').toLowerCase() == "file"
&& global.FileReader; && global.FileReader;
if (!supported) if (!supported || !this.files || this.files.length == 0)
return true; // continue to next input element
var instanceConfig = $.extend({}, config);
if (!this.files || this.files.length == 0)
return true; // continue to next input element return true; // continue to next input element
for (var i = 0; i < this.files.length; i++) for (var i = 0; i < this.files.length; i++)
@ -62,13 +57,14 @@
queue.push({ queue.push({
file: this.files[i], file: this.files[i],
inputElem: this, inputElem: this,
instanceConfig: instanceConfig instanceConfig: $.extend({}, config)
}); });
} }
}); });
parseNextFile(); parseNextFile(); // begin parsing
return this; // chainability return this; // maintains chainability
function parseNextFile() function parseNextFile()
{ {
@ -373,7 +369,7 @@
// NOTE/TODO: Many of the functions of NetworkStreamer and FileStreamer are the same. Consolidate?
function NetworkStreamer(config) function NetworkStreamer(config)
{ {
config = config || {}; config = config || {};
@ -469,7 +465,7 @@
} }
var results = handle.parse(aggregate); var results = handle.parse(aggregate);
aggregate = ""; // very important to reset each time a chunk is parsed aggregate = "";
if (IS_WORKER) if (IS_WORKER)
{ {
@ -584,7 +580,7 @@
} }
var results = handle.parse(aggregate); var results = handle.parse(aggregate);
aggregate = ""; // very important to reset each time a chunk is parsed aggregate = "";
if (IS_WORKER) if (IS_WORKER)
{ {

Loading…
Cancel
Save