use Set instead of Map
This commit is contained in:
@@ -7,11 +7,11 @@ export default class ChatListModel {
|
|||||||
storageModel: StorageModel;
|
storageModel: StorageModel;
|
||||||
|
|
||||||
// data
|
// data
|
||||||
chatModels = new Map<string, ChatModel>();
|
chatModels = new Set<ChatModel>();
|
||||||
|
|
||||||
// store & add
|
// store & add
|
||||||
addChatModel = (chatModel: ChatModel) => {
|
addChatModel = (chatModel: ChatModel) => {
|
||||||
this.chatModels.set(chatModel.id, chatModel);
|
this.chatModels.add(chatModel);
|
||||||
};
|
};
|
||||||
|
|
||||||
createChat = (primaryChannel: string): ChatModel => {
|
createChat = (primaryChannel: string): ChatModel => {
|
||||||
@@ -25,7 +25,7 @@ export default class ChatListModel {
|
|||||||
};
|
};
|
||||||
|
|
||||||
untrackChat = (chat: ChatModel): void => {
|
untrackChat = (chat: ChatModel): void => {
|
||||||
this.chatModels.delete(chat.id);
|
this.chatModels.delete(chat);
|
||||||
};
|
};
|
||||||
|
|
||||||
// restore
|
// restore
|
||||||
|
|||||||
Reference in New Issue
Block a user