Changed the number of tweets stored in local memory

This commit is contained in:
2022-11-02 11:42:29 +01:00
parent 4fa54fe1f1
commit abb8c77e3f

View File

@@ -83,7 +83,8 @@ block.fn.tweets = function(config) {
tweets = window.sessionStorage.getItem('tweets'); tweets = window.sessionStorage.getItem('tweets');
tweets = JSON.parse(tweets); tweets = JSON.parse(tweets);
tweets.push(tweet); tweets.push(tweet);
if(tweets.length >= options.memory) { var localMemory = 100;
if(tweets.length >= localMemory) {
tweets.shift(); tweets.shift();
} }
window.sessionStorage.setItem('tweets', JSON.stringify(tweets)); window.sessionStorage.setItem('tweets', JSON.stringify(tweets));