Skip to content

Commit

Permalink
fix(feed): always insert new feed item
Browse files Browse the repository at this point in the history
  • Loading branch information
DEgITx committed Jun 16, 2018
1 parent d2cc42f commit 385e701
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/background/feed.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ module.exports = class Feed {
this.feed[index] = Object.assign(this.feed[index], data) // just push up element
else
{
if(typeof data == 'object')
{
data.feedDate = Math.floor(Date.now() / 1000)
}

if(this.feed.length >= this.max)
{
//cleanup
Expand All @@ -63,15 +68,14 @@ module.exports = class Feed {
break

if(this.feed.length >= this.max)
return // two much for feed
this.feed[this.feed.length - 1] = data // replace last one
else
this.feed.push(data) // insert
}

if(typeof data == 'object')
else
{
data.feedDate = Math.floor(Date.now() / 1000)
this.feed.push(data) // insert
}

this.feed.push(data) // insert
}

this._order()
Expand Down

0 comments on commit 385e701

Please sign in to comment.