mirror of
https://github.com/chylex/Discord-History-Tracker.git
synced 2025-04-14 23:50:33 +03:00
Add a couple utility functions to renderer (retrieving messages and selected channel)
This commit is contained in:
parent
60a66690bd
commit
094ed75eca
@ -39,6 +39,10 @@ SAVEFILE.prototype.getMessageCount = function(channel){
|
||||
return Object.keys(this.data[channel]).length || 0;
|
||||
};
|
||||
|
||||
SAVEFILE.prototype.getAllMessages = function(){
|
||||
return Array.prototype.concat.apply([], Object.values(this.data).map(messageList => Object.values(messageList)));
|
||||
};
|
||||
|
||||
SAVEFILE.prototype.getMessages = function(channel){
|
||||
return this.data[channel] || [];
|
||||
};
|
||||
|
@ -42,6 +42,14 @@ var STATE = (function(){
|
||||
});
|
||||
},
|
||||
|
||||
getSelectedChannel: function(){
|
||||
return selectedChannel;
|
||||
},
|
||||
|
||||
getRawMessages: function(channel){
|
||||
return channel ? Object.values(FILE.getMessages(channel)) : FILE.getAllMessages();
|
||||
},
|
||||
|
||||
getMessageList: function(startIndex, count){
|
||||
if (!MSGS){
|
||||
return [];
|
||||
|
Loading…
x
Reference in New Issue
Block a user