Commit b3a6839e authored by Tristan Cavelier's avatar Tristan Cavelier

notification management part moved

Indeed, it avoid jIO to trigger timeout event if no documents are found.
parent cefca6fe
...@@ -388,6 +388,15 @@ ...@@ -388,6 +388,15 @@
var cursor = event.target.result, now; var cursor = event.target.result, now;
if (cursor) { if (cursor) {
// Called for each matching record. // Called for each matching record.
// notification management
now = Date.now();
if (date <= now - 1000) {
notify({"loaded": rows.length});
date = now;
}
// option.limit management
if (Array.isArray(option.limit)) { if (Array.isArray(option.limit)) {
if (option.limit.length > 1) { if (option.limit.length > 1) {
if (option.limit[0] > 0) { if (option.limit[0] > 0) {
...@@ -411,6 +420,7 @@ ...@@ -411,6 +420,7 @@
} }
} }
// option.include_docs management
if (option.include_docs) { if (option.include_docs) {
rows.push({ rows.push({
"id": cursor.value._id, "id": cursor.value._id,
...@@ -423,11 +433,8 @@ ...@@ -423,11 +433,8 @@
"value": {} "value": {}
}); });
} }
now = Date.now();
if (date <= now - 1000) { // continue to next iteration
notify({"loaded": rows.length});
date = now;
}
cursor.continue(); cursor.continue();
} else { } else {
notify({"loaded": rows.length}); notify({"loaded": rows.length});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment