Commit 2f40c41a authored by yPhil's avatar yPhil
Browse files

Pretty close now

- Unread count on subsequent refreshes
parent 2cba9592
...@@ -655,7 +655,7 @@ PTL.feed = { ...@@ -655,7 +655,7 @@ PTL.feed = {
if (data.thereArenewItems) { if (data.thereArenewItems) {
$feedBody.html($newFeedBodyUl); $feedBody.prepend($newFeedBodyUl);
$badge.fadeIn('slow').text(itemList[1]); $badge.fadeIn('slow').text(itemList[1]);
let ReadTransaction = db.transaction(PTL.DbStore, "readwrite"), let ReadTransaction = db.transaction(PTL.DbStore, "readwrite"),
......
...@@ -64,25 +64,46 @@ function getFeed (feedUrl, lastItem, nbItems, callback) { ...@@ -64,25 +64,46 @@ function getFeed (feedUrl, lastItem, nbItems, callback) {
return callback({error:error, errno:res.status, message:error.message}); return callback({error:error, errno:res.status, message:error.message});
}).on('readable', function() { }).on('readable', function() {
try { try {
var item = this.read(); var item;
if (item !== null){ while ((item = this.read())) {
i++;
console.error('item.link: %s (%s)', item.link); if (item !== null) {
i++;
if (typeof newLastItem == 'undefined') { if (typeof newLastItem === 'undefined') {
newLastItem = item.link; newLastItem = item.link;
} }
if (newLastItem == lastItem) { if (item.link !== lastItem) {
console.error('### Count reached i:%s, lastItem: [%s], newLastItem: %s', i, lastItem, newLastItem); console.error('item.link: %s (%s)', item.link);
this.resume(); // console.error('### PUSHING [%s] lastItem:[%s]', item.link, newLastItem);
} else {
feedItems.push(item); feedItems.push(item);
} else {
console.error('### i:[%s], This item:[%s], lastItem:[%s], newLastItem:[%s]', i, item.link, lastItem, newLastItem);
this.resume();
} }
}
} }
// if (item !== null){
// i++;
// console.error('item.link: %s (%s)', item.link);
// if (typeof newLastItem == 'undefined') {
// newLastItem = item.link;
// }
// if (newLastItem == lastItem) {
// console.error('### Count reached i:%s, lastItem: [%s], newLastItem: %s', i, lastItem, newLastItem);
// feedparser.destroy();
// // return false;
// } else {
// feedItems.push(item);
// }
// }
} }
catch (err) { catch (err) {
console.error('## feedParserCatchErr: %s (%s)', err, feedUrl); console.error('## feedParserCatchErr: %s (%s)', err, feedUrl);
......
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